Python un-plugging the Interpreter

Jorgen Grahn grahn+nntp at snipabacken.dyndns.org
Wed May 2 10:16:53 EDT 2007


On Wed, 25 Apr 2007 08:05:01 +0200, Hendrik van Rooyen <mail at microcorp.co.za> wrote:
> "Jorgen Grahn" <grahn+nntp at snipabacken.dyndns.org> wrote:
...
>> I doubt it. (But I admit that I am a bit negative towards thread
>> programming in general, and I have whined about this before.)
>> 
>
> I find this last statement interesting, because it differs so much
> from my own attitude - getting a thread running was one of the
> first things I did when I started getting to grips with python.
>
> Do you mind "whining" some more - maybe I can learn 
> something - threads seem to me to make a lot of things so 
> much easier and more natural, as I see them as sequences
> that run "at the same time",  and I find this immensely useful
> for all sorts of things, as it enables me to think in a simple
> linear fashion about parts of complicated things.

It's the other way around for me -- using a threaded design looks
superficially more linear, but all the complexity is still there, and
then some. I mean, threads are well known for causing surprising and
hard-to-track-down (and hard to trigger!) bugs and performance
problems.

(I'm comparing with the Unix select() call, and I assume the APIs I
want to use are designed to work with select(). i.e. use select()able
file descriptors.)

> And if you
> add queues, you have something in your hand that you can 
> do quite fancy stuff with in a robust, simple manner...
>
> *grin* before I discovered the queue module, I was using
> named pipes to communicate between threads...
>
> So you could say I am a threading freak if you want to, and 
> I won't argue.
>
> But I would like to hear the opposite viewpoint..

Good. My viewpoint is due to my Unix background (but I'm not
insinuating that all Unix users dislike threads).

Eric Raymond's "The Art of Unix Programming" sums up the threading
criticism, I think:

http://catb.org/~esr/writings/taoup/html/multiprogramchapter.html

/Jorgen

-- 
  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.dyndns.org>  R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list