Date: Mon, 20 Jun 2011 03:04:07 +1000 From: Lie Ryan User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110513 Lightning/1.0b3pre Thunderbird/3.1.10 ThunderBrowse/3.3.5 MIME-Version: 1.0 Newsgroups: comp.lang.python Subject: Re: threading : make stop the caller References: In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 110.175.240.90 X-Original-NNTP-Posting-Host: 110.175.240.90 Message-ID: <4dfe2c71$1@dnews.tpgi.com.au> X-Trace: dnews.tpgi.com.au!tpg.com.au 1308503153 110.175.240.90 (20 Jun 2011 03:05:53 +1000) Lines: 15 Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!news.snarked.org!newsfeed.news.ucla.edu!usenet.stanford.edu!news.kjsl.com!rahul.net!wasp.rahul.net!rahul.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!nntp3.phx1!dnews.tpgi.com.au!tpg.com.au!not-for-mail Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7987 On 06/20/11 02:52, Laurent Claessens wrote: > >> Popping task off the end of the list is more efficient: > >> while task_list: >> task_list.pop().start() > > That's cool. In my case it's better to do > task_list.pop(0).start > > in order to pop the first element. then you really wanted a queue instead of a list. There is a thread-safe `queue` module in the standard library.