promlems with threading and print

Piet van Oostrum piet at
Wed Jul 15 10:25:14 EDT 2009

>>>>> Piet van Oostrum <piet at> (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. I
am not very fond of global variables myself, however, that's why I used
the self.lock.

Piet van Oostrum <piet at>
URL: [PGP 8DAE142BE17999C4]
Private email: piet at

More information about the Python-list mailing list