questions about scope/threading

Aahz aahz at pythoncraft.com
Wed Oct 16 15:19:51 EDT 2002


In article <aoje8k$dpn$1 at newsreader.mailgate.org>,
eugene kim  <eugene1977 at hotmail.com> wrote:
>
>I understand thread differs from fork because thread shares local
>variables.  I'm having trouble understanding what's considered local
>variables..

Threads do *NOT* share local variables.  Threads share global variables.
The trick with Python is that *ALL* objects are truly global, so you
need to be careful with references to objects so that you either

* lock access to each object

* make sure that each object is referenced in only one thread at a time
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/



More information about the Python-list mailing list