[IPython-dev] replacement for deep_reload.py

Fernando Perez fperez at colorado.edu
Mon Oct 6 12:35:29 CDT 2003


Ralf Schmitt 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
> m=sys.modules.copy()
> sys.modules.clear()
> 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.

Great.  And don't worry: I have a trip this week which will shut me off from 
ipython for at least the rest of the week.  So take your time, and 0.5.1 will 
have quite a few nice goodies in it :)

Regards,

Fernando.



More information about the IPython-dev mailing list