Just discovered something really fantastic about ipython (well, besides all the cool stuff that was already there). It has some neat support for writing python doctests. If you press%doctest_mode
, ipython flips into a different prompt that looks like a doctest, with the leading angle brackets. This mode allows you to paste doctest snippets without needing to remove the leading brackets first, and it will execute the code. This format also means you can interactively write doctests, and then copy/paste to a doctest file (perhaps deleting a few lines). There is also a neat function, IPython.dtutils.idoctest()
that will let you paste a whole doctest, output and all, and it will execute it and tell you the results. Very useful for debugging doctests.
Since I can't seem to post something lately without mentioning bzr and launchpad, here it is: IPython is using bazaar and launchpad! Great to have you guys using the service. How about setting up a PPA with a newer Ubuntu package that includes all this cool doctest support?