Deprecating reload() ???

Peter Hansen peter at
Fri Mar 12 14:45:24 CET 2004

David MacQuigg wrote:

> I know this is the *intended* behavior of reload(), but it has always
> seemed to me like a bug.  Why would you *ever* want to keep pieces of
> an old module when that module is reloaded?

If you wanted a dynamic module, where changes would be picked up by the 
application from time to time, but didn't want to terminate existing 
instances of the old version.  There's nothing wrong with the idea that 
both old and new versions of something could exist in memory, at least 
for a while until the old ones are finished whatever they are doing.

Basically, envision an application update mechanism for long-running 
applications, and its special needs.

> Seems to me we should *fix* reload, not deprecate it.

Reload is not broken, and certainly shouldn't be deprecated at least 
until there's a better solution that won't suffer from reload's one 
problem, IMHO, which is that it surprises some people by its behaviour. 
  I think that when you consider Python's namespace mechanism, you can't 
avoid the possibility of situations like the ones reload can now lead to.


More information about the Python-list mailing list