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.
You have options -- Python standard library or IPython.
The Python standard library has a code module which has an InteractiveConsole class whose purpose is to "Closely emulate the behavior of the interactive Python interpreter." This would probably be able to do what you want, but the documentation doesn't have any examples on how to use this, and I don't have any suggestions on where to go.
IPython, which is a more advanced Python terminal, has the option to embed a console at any point in your program built in. According to their documentation, you can simply do
from IPython import embed
for thing in set_of_things:
embed()
do_stuff_to(thing)