re-importing modules

John Nagle nagle at animats.com
Mon Apr 30 23:46:42 EDT 2007


Gabriel Genellina wrote:
> En Mon, 30 Apr 2007 21:32:20 -0300, John Nagle <nagle at animats.com>  
> escribió:
> 
>> kyosohma at gmail.com wrote:
>>
>>>> In addition to the warning that reload() does not recursively reload
>>>> modules that the reloaded module depends on, be warned that reloading a
>>>> module does not magically affect any functions or objects from the old
>>>> version that you may be holding on to.
>>
>>
>>     Maybe reloading modules should be deprecated.  The semantics
>> are awful, and it interferes with higher-performance implementations.
> 
> 
> Maybe all the drawbacks should be clearly stated instead, telling that  
> it's not a magic wand as someone could think.

    It's one of those things which is more of an artifact of the CPython
implementation than a designed-in feature.  A more compile-oriented
implementation like ShedSkin has to go to considerable effort to support
a feature like this, and it's not all that useful anyway.

    There's a discussion of this, as it affects Jython and PyPy, here:

http://mail.python.org/pipermail/edu-sig/2007-March/007815.html

    Some of the enthusiasm for reloading comes from attempts to emulate
the older LISP environments, where the development environment lived
in the same namespaces as the execution environment.  That really
wasn't that great an idea even in the LISP era.  The Symbolics LISP
machines were the greatest expression of that idea, and turned out
to be a dead end.

					John Nagle



More information about the Python-list mailing list