Pausing until threads are done

Dave Brueck dave at pythonapocrypha.com
Thu Mar 13 10:49:05 EST 2003


On Thu, 13 Mar 2003, Christos TZOTZIOY Georgiou wrote:

> On Thu, 13 Mar 2003 07:50:52 GMT, rumours say that Alex Martelli
> <aleax at aleax.it> might have written:
>
> >Don't use the thread module in your application code: it's a very low
> >level module, meant basically as an engine for module threading, which
> >is the one you _should_ be using,
>
> Why _should_ he?  The question mark actually refers to "should", so I am
> asking about the reasoning.
>
> Actually, this is not a question directed only to Alex; I have also read
> others posting "don't use thread, you should use threading" or similar
> remarks, but the reasoning seems to be "dogmatic" (in quotes because I
> don't mean it in an offensive way) a la snickers-ads: "Just do it."

It's practical too: if you use thread rather than threading then nobody on
c.l.py will answer your questions! <0.5 wink>

> I would offer the following reasoning: "you _should_ use the threading
> module since it offers a much better abstraction of threading, but if
> you feel comfortable using directly the thread module, locks and queues,
> do so."

Yeah, that seems reasonable. Hmmm... but is there any benefit to using the
thread module directly other than slightly less overead? New features are
more likely to show up in threading than thread, other people reading your
code will expect threading rather than thread. You're probably right
though that it's not "wrong" to use thread directly (doesn't the Queue
module use it?).

-Dave





More information about the Python-list mailing list