[IPython-dev] replacement for deep_reload.py

Ralf Schmitt ralf at brainbot.com
Sun Oct 5 08:55:44 EDT 2003

Fernando Perez wrote:

> Great!  Many thanks for this.  Please give it a bit more pounding, and 
> I'd encourage other users of dreload to also try it out.  The code is 
> definitely far simpler than the original dreload, but since I don't 
> understand that code too well, I'd like to tiptoe a bit on this 
> issue.  If it survives a bit of pounding and discussion, I'll 
> definitely be glad to put it in.

One of the things where it differ's from the old deep_reload is that 
when importing a submodule, say ipbug.vm, it will not reload 
ipbug/__init__.py. I've attached another version, which tries to do just 
that and I'm using that version currently without problems.
However I think there must be an even  less complicated version.  
Clearing sys.modules and 'reimporting' the module like in the following 
code seems to work ok.
import sys, bbutils.textproc.spellcheck
sys.modules['sys'] = sys
import bbutils.textproc.spellcheck

Currently I don't have the time to investigate this further, but in a 
week or two, I'll  have another look at this.

- Ralf

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: deep_reload.py
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20031005/36b660b3/attachment.ksh>

More information about the IPython-dev mailing list