So, IPython rocks. But what if you want to use it deep inside a program to do a bit of exploratory programming with access to the full program state etc.? Just stick these two lines of code into the place you want to start off from:

from IPython.Shell import IPShellEmbed IPShellEmbed ([])()

More info on IPShellEmbed here.

I just discovered this, and it is unbelievably useful in some situations!