Python un-plugging the Interpreter

Hendrik van Rooyen mail at microcorp.co.za
Thu May 3 02:24:16 EDT 2007


"Jorgen Grahn" <grahn+nntp at snipabacken.dyndns.org> wrote:


> 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.)

This is a valuable insight - it is to a large extent true that threading is
used to "front end" i/o - but that is not its only use...

I tend to use it to build, via Queue glue, structures that resemble
systolic arrays - where each thread does a small part of a whole job.

>
> > 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

Thanks - interesting link. This guy really is not turned on by threading...

- Hendrik




More information about the Python-list mailing list