questions about scope/threading

eugene kim eugene1977 at
Wed Oct 16 19:28:35 CEST 2002

I understand thread differs from fork because thread shares local variables.
I'm having trouble understanding what's considered local variables..
any help will be greatly appreciated.
my questions are commented

class FetchUrlThread(threading.Thread):
    def __init__(self, blogUrl, blog_id):
        self.blogUrl = blogUrl             # is self.blogUrl a shared 
variable among threads or is blogUrl shared(has to be synchronized)?
        self.blog_id = blog_id            # even it's class variable?
        counter = 0                   # is this similar to C++ static 
     def run(self)
        counter = counter + 1
        self.someVar = MyClass(self.someVar2)  # should i worry about 
synchronizing about this statement?
     def Method1(self, var1)
        var1 = var1 + 1;  # what's the scope of var2?
        var2 = 10;        
        for var3 in var1:

More information about the Python-list mailing list