By default, during debugging in IPython, ipdb shows one line above and one line below the current position in code.
Is there an easy way to make the area shown a bit b
As a quick complement to https://stackoverflow.com/a/35883288/895245 this is the one liner that you generally want to add to the code you want to debug:
__import__('ipdb').set_trace(context=21)
You likely want to add a shortcut for that from your editor, e.g. for Vim snipmat I have:
snippet ipd
__import__('ipdb').set_trace(context=21)
so I can type just ipd
and it expands to the breakpoint. Then removing it is easy with dd
since everything is contained in a single line.
Feature request for ipdb to increase the default context
size: https://github.com/gotcha/ipdb/issues/147