Every once and a while, when working with Python-code, there comes the point where I think "well, if I could just have a Python-shell at this very point in the codeā€¦", be it for debugging or for inspection of objects because I'm to lazy to look up the documentation.

The solution is quite simple. Make sure you have the ipython-package installed and just place

import IPython
IPython.embed()

at the point where you want to have your Python-shell. And there you go, an ipython-shell with the full state of the code at the position of usage.