re-importing modules

John Nagle nagle at animats.com
Tue May 1 01:24:15 EDT 2007


Steven D'Aprano wrote:
> I'd hate for reload to disappear, it is great for interactive
> development/debugging, at least under some circumstances. (If you have
> complex and tangled class hierarchies, it might not be powerful enough.)
> 
> As for the semantics being awful, I disagree. reload() does exactly
> what it claims to do, no more, no less.

     It's more complicated than that.  See

       http://arcknowledge.com/lang.jython.user/2006-01/msg00017.html

Exactly what reloading should do is still an open question for some of
the hard cases.

     "reload" as a debug facility is fine.
Trouble comes from production programs which use it as a
reinitialization facility.

     Reloading a module with multiple threads running gets
complicated.  It works in CPython because CPython doesn't have
real concurrency.  Insisting that it work like CPython implies
an inefficient locking model.

					John Nagle



More information about the Python-list mailing list