Deprecating reload() ???

Peter Hansen peter at engcorp.com
Fri Mar 12 06:58:06 EST 2004


user at domain.invalid wrote:
> Ellinghaus, Lance wrote:
> 
>> I agree that it does not really work as most people think it does, but 
>> how
>> would you perform the same task as reload() without the reload()?
>> Would this be done by "del sys.modules['modulename']" and then perform an
>> 'import'?
> 
> Ah, interesting! I've been doing this:
> 
> del modulename; import modulename
> 
> but it doesn't pick up any recent changes to the modulename.py file.
> 
> That's a better solution than exiting Python and starting it up again. 

Just to clarify, *neither* of the above solutions does anything useful, 
as far as I know.  Only reload() will really reload a module.  Certainly 
the del mod/import mod approach is practically a no-op...

-Peter



More information about the Python-list mailing list