Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'handler': 0.05; 'socket': 0.07; 'cc:addr:python-list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sorts': 0.16; 'sources,': 0.16; 'subject:which': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'stack': 0.19; '(the': 0.22; 'code,': 0.22; 'cc:addr:python.org': 0.22; 'regardless': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'handling': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'generally': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'easier': 0.31; 'that.': 0.31; 'about.': 0.31; 'own,': 0.31; 'probably': 0.32; 'cases': 0.33; 'problem': 0.35; 'basic': 0.35; "can't": 0.35; 'something': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'subject:?': 0.36; 'resource': 0.38; 'anything': 0.39; 'does': 0.39; '12,': 0.39; 'structure': 0.39; 'sure': 0.39; 'space': 0.40; 'how': 0.40; 'ensure': 0.60; 'worry': 0.60; 'more': 0.64; 'different': 0.65; 'mar': 0.68; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=4RC4D4AeNM+U4MgOVmIriD8SXtR+g89Ldm7GrPf8PZs=; b=JYQwfZPy5hxaHwsTKIhviCGQhsWJDhQAHZYD2xGg91MAPRri3B7bDOS9gqJWuTzdjd xC/wbnV1XTHdqumX7pN4Nqq/IfQyEYERmzq2JzidoxrsuY85wGOaNEk+cZZiis+K9KT/ 5dcOXTIplrux1Bt2uj/7opUdY1TxtYaNjTZU1aGbre2P+2FJNk21WBOrAfit6t0luhzI uMNPf51zaA2YWDGmnrcFVDdW3I7K5PS0YdSbSU6pwjNL2whaS3lO40bhtKCSbkg9ew+L Vi30qOwMCq8Dr/EkWhQSJrQDJzUOqac9NedQVCp4dFpvJj+4x5IYDF91GhQ4LN1pn3Zi GvZw== MIME-Version: 1.0 X-Received: by 10.66.129.133 with SMTP id nw5mr746328pab.98.1394577514102; Tue, 11 Mar 2014 15:38:34 -0700 (PDT) In-Reply-To: <877g80nzdx.fsf@elektro.pacujo.net> References: <531E22DF.7030709@simplistix.co.uk> <1733040935416225908.878896sturla.molden-gmail.com@news.gmane.org> <372076480416251284.821607sturla.molden-gmail.com@news.gmane.org> <877g80nzdx.fsf@elektro.pacujo.net> Date: Wed, 12 Mar 2014 09:38:33 +1100 Subject: Re: which async framework? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394577523 news.xs4all.nl 2860 [2001:888:2000:d::a6]:37399 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68246 On Wed, Mar 12, 2014 at 9:28 AM, Marko Rauhamaa wrote: > If you can't write your own event loop, you probably can't be trusted > with any multithreaded code, which has much more baffling corner cases. I'm not sure about that. Threads are generally easier to handle, because each one just does something on its own, sequentially. (The problem with threads is the resource usage - you need to allocate X amount of stack space and other execution state, when all you really need is the socket (or whatever) and some basic state about that.) Regardless of how you structure your code, you have to ensure that one handler doesn't tread on another's toes, and with multithreading, that's _all_ you have to worry about. A proper event loop, handling events from all sorts of different sources, is far more complicated. What corner cases are there with threads that you don't have with anything else? ChrisA