simple Thread question

Aahz aahz at pythoncraft.com
Fri Aug 20 22:02:57 CEST 2004


In article <aqOdnXhiyaIBY77cRVn-jA at powergate.ca>,
Peter Hansen  <peter at engcorp.com> wrote:
>Aahz wrote:
>> In article <l82dnQLW7bZOIb_cRVn-qQ at powergate.ca>,
>> Peter Hansen  <peter at engcorp.com> wrote:
>>> 
>>>While it's true that that is all that's needed, it is not required,
>>>and doesn't really provide any performance improvements.  I often do
>>>the above sort of thing where I use a given module in only one place,
>>>especially when using threads where it feels subtly cleaner to defer
>>>loading of some modules until the thread actually starts.
>> 
>> Except that the import lock makes this a Bad Idea, IMO.
>
>Does the import lock apply to the first import, or even
>to all later ones where it can just find it in sys.modules?

It applies to all -- after all, sys.modules gets updated before the
module code is run...
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"To me vi is Zen.  To use vi is to practice zen.  Every command is a
koan.  Profound to the user, unintelligible to the uninitiated.  You
discover truth everytime you use it."  --reddy at lion.austin.ibm.com



More information about the Python-list mailing list