Deprecating reload() ???

Greg Ewing (using news.cis.dfn.de) wmwd2zz02 at sneakemail.com
Mon Mar 15 02:19:58 CET 2004


Skip Montanaro wrote:
> Not so.  del sys.modules['mod']/import mod is effectively what reload()
> does.

Not quite -- reload() keeps the existing module object and changes
its contents, whereas the above sequence creates a new module
object.

The difference will be apparent if any other modules have done
'import mod' before the reload.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list