threads only called once?
Peter Hansen
peter at engcorp.com
Wed Aug 7 08:27:14 EDT 2002
Gerson Kurz wrote:
>
> >>> import threading
> >>> class test(threading.Thread):
> ... def run(self):
> ... print "run called"
> ...
> >>> t = test()
> >>> threading.Thread( target = t.run ).start()
> run called
> >>> threading.Thread( target = t.run ).start()
> run called
> >>> threading.Thread( target = t.run ).start()
> run called
> >>> ...
Why do something like that? You can just repeatedly create
instances of the "test" class (might be better renamed Test,
by the way, according to the usual convention) and .start()
them... anyway, what's wrong with having to create a new
thread object each time?
-Peter
More information about the Python-list
mailing list