views:

161

answers:

2

Python provides several methods to create threads. Which provides the best API and the most control?

Thanks.

+4  A: 

I believe the threading module is the recommended one. The thread module is being renamed to _thread in Python 3.x, and is meant as a lower-level interface. See the note at the top of this page:

http://docs.python.org/library/thread.html

DNS
+8  A: 

When necessary, the threading module and its high-level interface is preferred. Of course, many people suggest that it's rarely/never necessary, and threads aren't very nice to deal with. The thread module may be necessary for some weird use-case or other, but I've never needed it (and of course, I've only rarely used threading, a long time ago). There's some other modules that do neater things, such as multiprocessing, which may be of interest. That doesn't do threading, it just shares the interface (quite cool). I've heard good things about it, but haven't wanted anything like either of them for quite a while.

Devin Jeanpierre