[IPython-user] re set doesn't

David Warde-Farley dwf@cs.toronto....
Tue Dec 8 22:12:44 CST 2009

Forgot that this list doesn't munge reply-to's, so c+p'ing a reply  
sent in private accidentally:

On 7-Dec-09, at 7:06 PM, Dr. Phillip M. Feldman wrote:

> reset does not undo the effect of any imports,

Since modules can have arbitrary side effects in Python, it would be  
impossible to know what a module has changed and what it hasn't, and  
the interpreter itself doesn't really have support for killing/re- 
loading modules. In short, this isn't a limitation of IPython, this is  
a limitation of _Python_.

%run is somewhat useful in this circumstance for re-executing single  
files (though be wary of imports in the script that you %run, as those  
won't get re-imported if they have changed, unfortunately)

> does not close any figure windows that have been opened

See Robert's comment. Having commands tied to matplotlib (or any other  
external library) would be bad mojo. Having "%reset" behave  
differently depending on what GUI toolkit you're using is likewise an  
ugly situation.

If you have launched IPython with -pylab then close('all') will do the  
trick for matplotlib figures. You can easily alias that to %foo or  
something easy to type/remember in your ipy_user_conf.py.

> and issues an annoying and unnecessary prompt that could
> equally well be, "Has your sanity been confirmed recently by competent
> authorities?"

There might be room for a %Reset to go with %Exit (which exits without  

> 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.

History as in arrow key buffer? That should be saved between sessions  
unless you're running multiple sessions and they're clobbering each  


More information about the IPython-user mailing list