[Python-Dev] Confusing behaviour relating to module objects being GCed.

Steven Taschuk staschuk@telusplanet.net
2003年6月13日 09:26:54 -0600


Quoth Troels Therkelsen:
> [...] I did post this message to c.l.py and nobody has seemed
> to care to actually try to explain what is happening.

I asked about the same thing in c.l.py on 23 May and got useful
replies:
 <http://groups.google.com/groups?th=e72d71f1ee1a0042>
The short explanation is that zapping the module's dict is useful
during interpreter shutdown, and it is assumed that modules do not
get collected except at shutdown. The quick fix is thus simply
not to let your modules get collected. (The normal import
mechanism does this by placing references in sys.modules.)
For more, see the aforelinked c.l.py thread.
-- 
Steven Taschuk staschuk@telusplanet.net
"I'm always serious, never more so than when I'm being flippant."
 -- _Look to Windward_, Iain M. Banks

AltStyle によって変換されたページ (->オリジナル) /