Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed2.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '16,': 0.03; 'argument': 0.05; 'classes,': 0.05; 'url:pipermail': 0.05; 'feature,': 0.09; 'generators': 0.09; 'objects:': 0.09; 'skip:/ 10': 0.09; 'python': 0.11; 'thread': 0.14; '"def"': 0.16; 'argument,': 0.16; 'block.': 0.16; "guido's": 0.16; 'subject:generator': 0.16; 'thread,': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'written': 0.21; 'mon,': 0.24; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'correct': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'regular': 0.32; 'another': 0.32; 'url:python': 0.33; 'bugs': 0.33; 'could': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'keyword': 0.36; 'url:org': 0.36; 'starting': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'read': 0.60; 'first': 0.61; 'more': 0.64; 'great': 0.65; 'dont': 0.67; 'mar': 0.68; '2015': 0.84; 'confusing': 0.84; 'glance': 0.84; 'url :python-dev': 0.84; 'affairs': 0.91; 'won': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=3TowUap5UBugTmvFJczUaalhlGLvgUAXD5HZKwWZ1sU=; b=AwcgZcY1AOICXuPfwOpa1O1QRrLDbqUekuItcQEjXGCNm08M57d8MmaXc4+o+GqHsy GM9fXOPznGm+0+xhyVm97/yFuGz3WdBenGy4ExwDvji+r3m7ItUPLr0IoM2fV6WueTgc 3Iq3R29SpZYg3sWLudDNgcDKILX0lFWuxQ6Modpoem3n2iW4iMlXUQSx7Cod+MJoWAiJ g07Lar9LKYjG01xqQ5dwV2MhOKpXLgciBRHjh+S+aeQqj0CEwIwKTLt9YvuClFfQ6Vv9 nJNRdL46U+IhadfHwPmoDzLtDGx8++/asBVJK0R3LAfJNsmwvIfqw+Io0tNeDqnwLUBI J/rA== X-Received: by 10.66.164.98 with SMTP id yp2mr63176560pab.114.1426517609256; Mon, 16 Mar 2015 07:53:29 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <5506dd28$0$12975$c3e8da3$5496439d@news.astraweb.com> References: <5501be8b$0$13006$c3e8da3$5496439d@news.astraweb.com> <874mpnp6nv.fsf@elektro.pacujo.net> <87y4mznmj8.fsf@elektro.pacujo.net> <55062bda$0$12998$c3e8da3$5496439d@news.astraweb.com> <87egopmn4z.fsf@elektro.pacujo.net> <55069623$0$12901$c3e8da3$5496439d@news.astraweb.com> <87vbi1qg0t.fsf@elektro.pacujo.net> <7cf04117-0fd5-40fb-bcaf-351353afc68b@googlegroups.com> <5506dd28$0$12975$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Mon, 16 Mar 2015 08:52:48 -0600 Subject: Re: generator/coroutine terminology To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1426517612 news.xs4all.nl 2867 [2001:888:2000:d::a6]:59094 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87566 On Mon, Mar 16, 2015 at 7:39 AM, Steven D'Aprano wrote: > On Mon, 16 Mar 2015 11:51 pm, Rustom Mody wrote: > >> It may help to read this 15 year old thread starting >> https://mail.python.org/pipermail/python-dev/2001-June/015478.html >> to see how many python stalwarts dont like the current state of affairs > > /s/dont/didn't/ > > That's a fifteen year old thread, written before generators were introduced. > Guido's intuition has been vindicated -- generators have proven to be a > great and powerful feature, and the reuse of "def" for both generator > functions and regular functions has turned out to be no more confusing in > practice than the use of "def" for both functions and methods[1]. > > > The argument is that generator-producers (def-with-yield) are not like > regular functions because calling the def-with-yield doesn't execute the > code inside them. Given three objects: There is another argument, which is that for functions and classes, the descriptive keyword ("def" or "class") is the first thing you see when reading the code. For generators, the descriptive keyword ("yield") could be buried *anywhere* in that block. One can glance at a generator function and fail to notice that it is a generator function. This is the one that really bugs me about reuse of "def", although you are correct that this is a case where practicality has won over purity.