Automatic reload()?

Darrell Gallion darrell at dorb.com
Sat Jun 3 20:47:45 EDT 2000


Michael Hudson wrote:

> def rr(keepem=sys.modules.keys()):
>     for i in sys.modules.keys():
>         if type(sys.modules[i]) is types.ModuleType and i not in keepem:
>             print "reloading",i
>             reload(sys.modules[i])
>
> I can't remember quite what the "keepem" bit's for, but I presume
> there was some reason I put it in...
>
Just guessing..
keepem will have the current list of modules, when this module is run. So
new modules will be reloaded because they aren't in that list.

Cool idea.


--Darrell Gallion





More information about the Python-list mailing list