Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'programmer': 0.03; '(at': 0.04; '(even': 0.05; 'argument': 0.05; '"if': 0.09; 'php,': 0.09; 'properly.': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'mostly': 0.14; 'thread': 0.14; 'against)': 0.16; 'burak': 0.16; 'clear.': 0.16; 'code?': 0.16; 'competent': 0.16; 'expert,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'indent': 0.16; 'nightmare': 0.16; 'programmer,': 0.16; 's/he': 0.16; 'there?': 0.16; 'unexpectedly': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'wed,': 0.18; 'possible,': 0.19; 'skip:f 30': 0.19; 'split': 0.19; 'stack': 0.19; 'code,': 0.22; 'programming': 0.22; 'cc:addr:python.org': 0.22; 'junior': 0.24; 'earlier': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'least': 0.26; 'header:In-Reply- To:1': 0.27; 'generally': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'comments': 0.31; 'forces': 0.31; 'ok.': 0.31; 'produces': 0.31; 'styles': 0.31; 'with,': 0.31; 'probably': 0.32; 'run': 0.32; 'another': 0.32; 'entirely': 0.33; 'framework': 0.33; 'problem': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'really': 0.36; 'possible': 0.36; 'turn': 0.37; 'problems': 0.38; 'depends': 0.38; 'pm,': 0.38; 'anything': 0.39; 'does': 0.39; 'bad': 0.39; 'flow': 0.39; 'though,': 0.39; 'either': 0.39; 'how': 0.40; 'problems.': 0.60; 'helps': 0.61; 'skip:n 10': 0.64; 'more': 0.64; 'different': 0.65; 'judge': 0.68; 'quality': 0.72; 'forced': 0.84; 'goto': 0.84; 'seeing,': 0.84; 'favour': 0.91; '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=A4ED7ty4KjlBppNNl++By3zmhUbDOZeEpcF802BdFOw=; b=oevxl5j7MU1R+7StlrEOzNU7KpoEqaLbXiO2VIhiPndip6A1XLop/vxQsy+bAcRNX1 xQu+B043fzUAUGCfrDFQMU1Drn5BGA867QJjIX0MZwWaOMXY+kYpZCePGm/22BXfQArt 7YT5OgA2YFlpBSfm9rhBIWlcqsTZOkJEsHFs/HmenOtoHR0xdZgZWGsu4yV8SL1b7qgE FsPaxcs5zBT8ANacAuANMyH7lWi761AJrVsvEmFLJk6El/wFV4pUDyaQ9UvSC/SK6GGq KBRFmKSVh5WRue8XscViTf2JwFuARqBXeNx2xC1J6HWtFmPqCcRr0QJ0IWsDcuQPYO2G MDhA== MIME-Version: 1.0 X-Received: by 10.220.133.197 with SMTP id g5mr41442445vct.20.1401867038870; Wed, 04 Jun 2014 00:30:38 -0700 (PDT) In-Reply-To: <538EAA54.2000308@arskom.com.tr> References: <874n03t5t9.fsf@elektro.pacujo.net> <7x4n03dor0.fsf@ruckus.brouhaha.com> <878upe8poc.fsf@elektro.pacujo.net> <87wqcyuznv.fsf@elektro.pacujo.net> <538DABE0.1070902@arskom.com.tr> <538EAA54.2000308@arskom.com.tr> Date: Wed, 4 Jun 2014 17:30:38 +1000 Subject: Re: Benefits of asyncio 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401867048 news.xs4all.nl 2955 [2001:888:2000:d::a6]:45269 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72609 On Wed, Jun 4, 2014 at 3:10 PM, Burak Arslan wrote: > Ah ok. Well, a couple of years of writing async code, my not-so-objective > opinion about it is that it forces you to split your code into functions, > just like Python forces you to indent your code properly. This in turn > generally helps the quality of the codebase. That's entirely possible, but it depends hugely on your library/framework, then - see earlier comments in this thread about Node.js and the nightmare of callbacks. One thing I'm seeing, though, the more different styles of programming I work with, is that since it's possible to write good code in pretty much anything (even PHP, and my last boss used that as a counter-argument to "PHP sucks"), and since a good programmer will write good code in anything, neither of these is really a good argument in favour of (or against) a feature/library/framework/style. Python forces you to indent your code. Fine! But a good programmer will already indent, and a sloppy programmer isn't forced to be consistent. (At worst, you just add "if True:" every time you unexpectedly indent.) To judge the quality of a framework based on code style, you need to look at a *bad* programmer and what s/he produces. A bad programmer, with just GOTO and line numbers, will often produce convoluted code that's completely unreadable; a bad programmer with a good suite of structured control flow will more generally stumble to something that's at least mostly clear. So how does async vs threaded stack up there? A competent programmer won't have a problem with either model. A mediocre programmer probably will think about one thing at a time, and will then run into problems. Threading produces these problems in one set of ways, asyncio produces problems in another set of ways. Which one would you, as an expert, prefer to deal with in a junior programmer's code? ChrisA