a very newbie question about threading

Peter Hansen peter at engcorp.com
Fri Nov 12 23:01:37 EST 2004


Jeremy Bowers wrote:
> On Fri, 12 Nov 2004 16:29:53 -0800, Chris Patton wrote:
>>I've recenently stumbled upon a concept known as "threading". 
> 
> I'd add that with no insult intended, "threading" and "very newbie" do not
> go together well. Threading is the most common source of the notorious
> "heisenbug", ...
> Generally, unless you *know* you need them, you don't, ...

Excellent post, Jeremy, though I think it's worth adding something
like this:

Python makes writing threaded code much more straightforward than
many languages, and also provides some protection from some types
of bugs which are almost ubiquitous in threaded applications in
some other languages.  By sticking with the Queue object (see the
module by that name) as the sole means of communication between
threads, the vast majority of other thread-related problems
simply disappears.  Not all of them -- and Jeremy's caution about
threads giving even expert programmers pause applies -- but in
general Python's not a bad place to learn and use threads...

-Peter



More information about the Python-list mailing list