Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'handler': 0.05; 'processing.': 0.07; 'abstraction': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'thread': 0.14; 'handler,': 0.16; 'language)': 0.16; 'losing': 0.16; 'message-id:@4ax.com': 0.16; 'mutable': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'threads.': 0.16; 'bit': 0.19; "hasn't": 0.19; 'passing': 0.19; 'url:home': 0.24; 'paul': 0.24; 'sort': 0.25; 'header:X-Complaints-To:1': 0.27; '-0700,': 0.31; 'closer': 0.31; 'concern': 0.31; 'know.': 0.32; 'bugs': 0.33; 'but': 0.35; 'charset:us-ascii': 0.36; 'too': 0.37; 'received:76': 0.38; 'tasks': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'worry': 0.60; 'helps': 0.61; "you've": 0.63; 'hearing': 0.63; 'between': 0.67; 'led': 0.72; 'interrupt': 0.84; 'polling': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: threading Date: Mon, 07 Apr 2014 19:47:37 -0400 Organization: IISS Elusive Unicorn References: <87d2gt4td2.fsf@elektro.pacujo.net> <7xha651yx2.fsf@ruckus.brouhaha.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-249-19-16.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1396914468 news.xs4all.nl 2869 [2001:888:2000:d::a6]:38496 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69821 On Sun, 06 Apr 2014 22:39:05 -0700, Paul Rubin declaimed the following: >I keep hearing about all the perils of threading bugs and it just hasn't >happened to me in Python as far as I know. The main trick is to not >share any mutable data between threads. Instead have them communicate >by message passing through Queues. If you've got a lot of tasks in the >system then it helps to have a bit of abstraction to keep the queues >organized and make the other tasks addressible by name, but it's all >pretty straightforward. You do take an efficiency hit, but if that's a >big concern you sort of have to look past Python. > That's been my experience too... Threading works for me... My attempts at so called asyncio (whatever language) have always led to my having to worry about losing data if some handler takes too long to return. To me, asyncio is closer to a polling interrupt handler, and I still need a thread to handle the main processing. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/