Threading HowTo's in Windows platforms

Scott David Daniels scott.daniels at acm.org
Sat Jul 1 14:19:13 EDT 2006


Jean-Paul Calderone wrote:
> On Sat, 01 Jul 2006 16:36:02 GMT, LittlePython <littlepython at lost.com> 
> wrote:
>> I am looking for some good beginner how-to links and maybe some simple
>> example scripts that perform threading on windows platforms. Hopefully
>> authors who don't mind doing "a little spoon feeding" would be great 
>> as I am a "baby python" who is very green with threading....
> 
> Threaded programming is extremely difficult.  Most good newbie 
> introductions to it consist of warnings not to use it.

Just to expand on this reply -- even experts avoid threading unless
necessary.  The real reason that everyone hates threading is that
wrong programs can run correctly, and errors cannot be reproduced.
Apparently, threaded programs have a "demo detector" that makes them
go wrong in the presence of anything more than a single vice president
(or major customer).

So, the standard Python advice is to have each thread completely
independent (sharing no data), and communicating only with instances
of queue.Queue.  That keeps the "demo detector" in check, because
you then have individually predictable (and hopefully testable)
parts with a logable communication pattern.  You still may have
trouble (to which the best reply is, "See, we told you so.").

--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list