Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!81.171.88.16.MISMATCH!eweka.nl!hq-usenetpeers.eweka.nl!news.astraweb.com!border2.a.newsrouter.astraweb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:Python': 0.06; 'class,': 0.07; 'cc:addr:python-list': 0.11; 'assume': 0.14; 'thread': 0.14; '*always*': 0.16; 'curious.': 0.16; 'eckhardt': 0.16; 'subject:Query': 0.16; 'suggested,': 0.16; 'thread,': 0.16; 'threads,': 0.16; 'threads.': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'aug': 0.22; 'handles': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'header:User- Agent:1': 0.23; 'file.': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'said,': 0.30; "i'm": 0.30; 'that.': 0.31; 'file': 0.32; 'run': 0.32; 'quite': 0.32; 'running': 0.33; 'actual': 0.34; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'doing': 0.36; 'represent': 0.38; 'problems': 0.38; 'pm,': 0.38; 'does': 0.39; 'most': 0.60; 'tell': 0.60; 'new': 0.61; 'simple': 0.61; 'to:addr:gmail.com': 0.65; 'safe': 0.72; 'to:charset:iso-8859-1': 0.74; 'clearer': 0.84; 'huh?': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; bh=s5LxwpSnjVbCErPBaLTHDwY/ak5CqfCDxzj8GT2HywM=; b=icY4dRq5JvshX4v+6p7uZSa44Y8R7nJ3UhYGhvW+gyKs3d5xrqKtLl/YjVW4z2qaXh SJfWILkiLydy1Jr6jdlB+QcOKTHSkvhZul6mZ5e/7EUUjvQ6BwI1baaJvnKt6M5II07q IajrF3e0LYpTm4/3kTFGnquRQ4EJ5LXYXXvotCskz/f8xrLWJeMqPeouEHN5elkMCdFh nVfzzSumYpyCN2SjHN30xTP7I0xLSXdkDK6jxtoQhCwc22ozoUD8FIVz4mALTV6H55Oh QPz+fanY6dK6nVTZJNoVveu8VdGNFn4VpQQfBMyDCXtal26d+RDWw+JNreiKVYzXI12c rutw== X-Received: by 10.236.56.71 with SMTP id l47mr16191yhc.79.1377129988250; Wed, 21 Aug 2013 17:06:28 -0700 (PDT) Sender: Ned Batchelder Date: Wed, 21 Aug 2013 20:06:25 -0400 From: Ned Batchelder User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: =?ISO-8859-1?Q?F=E1bio_Santos?= Subject: Re: Basic Python Query References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------050207000409040403040606" Cc: python-list@python.org, Johannes Bauer X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 105 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1377133512 news.xs4all.nl 15949 [2001:888:2000:d::a6]:46085 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52802 This is a multi-part message in MIME format. --------------050207000409040403040606 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit On 8/21/13 6:50 PM, Fábio Santos wrote: > > > On 21 Aug 2013 20:07, "Johannes Bauer" > 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. --------------050207000409040403040606 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 8/21/13 6:50 PM, Fábio Santos wrote:


On 21 Aug 2013 20:07, "Johannes Bauer" <dfnsonfsduifb@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.

--------------050207000409040403040606--