Basic Python Query

Ned Batchelder ned at nedbatchelder.com
Wed Aug 21 20:06:25 EDT 2013


On 8/21/13 6:50 PM, Fábio Santos wrote:
>
>
> On 21 Aug 2013 20:07, "Johannes Bauer" <dfnsonfsduifb at gmx.de 
> <mailto:dfnsonfsduifb at gmx.de>> wrote:
> >
> > On 21.08.2013 11:11, Ulrich Eckhardt wrote:
> >
> > > That said, there is never a need for deriving
> > > from the Thread class, you can also use it to run a function without
> > > that. That way is IMHO clearer because the threading.Thread 
> instance is
> > > not the thread, just like a File instance is not a file. Both just
> > > represent handles for manipulating the actual thing.
> >
> > Huh? That I find most curious.
> >
> > I *always* derive from threading.Thread and really like the way that
> > thread setup works (instanciate Thread handle, call start). Very
> > intuitive, never had the problems with clarity that you mentioned. Could
> > you elaborate on your suggestion? I don't seem to quite get it I'm 
> afraid.
> >
> > Best regards,
> > Johannes
>
> I cannot tell whether you are trolling or are just new to this, but 
> you don't always have to use threads. You use threads when you need 
> multiple parts of your program running concurrently. Don't inherit 
> Thread if all you are doing is a simple object with state, nor if your 
> program does not need concurrency.
>
>
I think it is safe to assume that Johannes meant, "when I use threads, I 
never do it the way you suggested, I always derive from threading.Thread."

--Ned.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130821/cb6f6c84/attachment.html>


More information about the Python-list mailing list