Exploratory programming with IPython

Posted in:

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!


Update 2022:

The code you want with modern IPython is:

import IPython; IPython.embed()

Comments §

Comments should load when you scroll to here...