need some help with threading module...

M.E.Farmer mefjr75 at hotmail.com
Mon Dec 27 00:12:49 CET 2004


Just a warning!
Threads and newbies don't mix well,
many pitfalls and hard to find bugs await you.
I would avoid using threads if at all possible.

Now we have all that over lets see some code.

py> import threading
py> class Test(threading.Thread):
...        def run(self):
...             x = 0
...             while x < 10:
...                 print x
...                 x += 1
...             print " Ending"
Use it like this:
py> Test().start()

There are other ways to do this, but you need to do a web  search on
threading.py , there are many examples out there. 
hth,
M.E.Farmer




More information about the Python-list mailing list