I\'m running my Python program and have a point where it would be useful to jump in and see what\'s going on, and then step out again. Sort of like a temporary console mode.
From Python 3.7 onwards, you can also use breakpoint()
to get into the debugger, e.g.:
for thing in set_of_things:
breakpoint()
do_stuff_to(thing)
This is a little easier to remember and write, and will open your code in pdb by default.
However, it's also possible to set the PYTHONBREAKPOINT
environment to the name of a callable, which could be another debugger such as pudb
or ipdb
, or it could be IPython's embed
, or anything else.