[IPython-user] re set doesn't

Robert Kern robert.kern@gmail....
Mon Dec 7 18:19:58 CST 2009

On 2009-12-07 18:06 PM, Dr. Phillip M. Feldman wrote:
> I was initially overjoyed to hear that my request for a reset command had
> borne fruit, but on closer examination I'm less enthusiastic. reset does not
> undo the effect of any imports, does not close any figure windows that have
> been opened, and issues an annoying and unnecessary prompt that could
> equally well be, "Has your sanity been confirmed recently by competent
> authorities?"  I find that I'm constantly killing off IPython and restarting
> it, but the penalty of this is that one's history is also lost.  It would be
> great if there were a reset command that really worked.

1. Imports of extension modules simply can't be undone in Python. Knowing which 
pure Python modules can be safely removed and those that can't is nearly 
impossible. Keep in mind that IPython uses many modules itself. Let us know if 
you figure out such a way.

2. GUI windows are the responsibility of the libraries that made them. While 
IPython has some matplotlib-specific support via -pylab, making %reset have 
matplotlib-specific code is simply not in the cards. Neither is Chaco-specific 
figure handling or Mayavi or Veusz or anything else of that kind.

If you want a %reset that works the way you want it to and has library-specific 
code for the libraries that you use, you can write your own %reset magic and 
enable it in your ipy_user_conf.py . It's straightforward.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the IPython-user mailing list