Deprecating reload() ???

Peter Hansen peter at engcorp.com
Fri Mar 12 13:29:48 EST 2004


Skip Montanaro wrote:
> Regarding
> 
>     >> del sys.modules['modulename']; import modulename
> 
> vs.
> 
>     >> del modulename ; import modulename
> 
> Peter sez:
> 
>     Peter> Just to clarify, *neither* of the above solutions does anything
>     Peter> useful, as far as I know.  Only reload() will really reload a
>     Peter> module.  Certainly the del mod/import mod approach is practically
>     Peter> a no-op...
> 
> Not so.  del sys.modules['mod']/import mod is effectively what reload()
> does.  

Oops, sorry.  On reflection that seems logical, but I thought there was 
a little more to reload() than just this. :-(

-Peter



More information about the Python-list mailing list