Re: promlems with threading and print

2009-07-15 Thread Piet van Oostrum
> Piet van Oostrum (PvO) wrote: >PvO> def run(self): >PvO> with lock: All the 'with lock:' lines should have been 'with self.lock:' but as lock is also a global variable, it did work. Of course you can decide to use only the global variable and get rid of the self.lock altogether

Re: promlems with threading and print

2009-07-15 Thread Piet van Oostrum
> Andreas Grommek (AG) wrote: >AG> Hi Newsgroup, >AG> I'm new to python and I am familiarizing myself with threads >AG> (haven't done any threading in any other language before...). I was >AG> playing around and discovered some weird behavior. Here is my code: When you start programming with

promlems with threading and print

2009-07-15 Thread Andreas Grommek
Hi Newsgroup, I'm new to python and I am familiarizing myself with threads (haven't done any threading in any other language before...). I was playing around and discovered some weird behavior. Here is my code: import threading from time import sleep from random import random import sys class