On 20 Sep 2006 00:27:07 -0700, daniel <[EMAIL PROTECTED]> wrote: > Hello, > Can anyone explain the main points in working with threads in Python. > Why use threading and not Thread.I have read an article that i have to > subclass the Thread class and override some function.
I repeat this all the time, but the best advice I can give you about using threads is to not use threads at all. I would point you to good references like Threads Considered Harmful (http://www.kuro5hin.org/story/2002/11/18/22112/860) and The Problem with Threads (http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.html - With Link to PDF). It might seem an inappropriate response to your question to simply tell you that you should not do what you are asking how to do, but its just the case that most often anyone without exposure to threads has little or no understanding on just how bad they are for many of the tasks they will be used for. Threads are difficult to control, impossible to predict, and simply one of the most over used, least understood causes of buggy, unmaintainable software in the whole spectrum of development techniques. As alternatives, look into what tasks can spawn into other processes, asyncronous programming (a'la Twisted - http://www.twistedmatrix.com/), and co-routine and similar facilities, such as the tasklets of Stackless and two-way generators now included with Python. -- http://mail.python.org/mailman/listinfo/python-list