Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3a.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(at': 0.04; '*is*': 0.09; 'arguments,': 0.09; 'function,': 0.09; 'cc:addr:python-list': 0.11; '"object': 0.16; 'factory': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'function"': 0.16; 'function?': 0.16; 'positional': 0.16; 'reasonable.': 0.16; 'subject:generator': 0.16; 'weird': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'sort': 0.25; "i've": 0.25; '15,': 0.26; 'possibly': 0.26; 'subject:/': 0.26; 'header :In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'returned': 0.30; 'message-id:@mail.gmail.com': 0.30; 'object.': 0.31; 'class': 0.32; 'could': 0.34; 'definition': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'keyword': 0.36; 'called': 0.40; 'how': 0.40; 'read': 0.60; 'back': 0.62; 'more': 0.64; 'different': 0.65; 'mar': 0.68; 'special': 0.74; '2015': 0.84; '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=zW2lbk9X1DoH9PmegUBVC1rTkMMfDl+Lip+6qN6WpIw=; b=s4uCezqIEMvxLThWBfcMPndkOhEtPdN8vjjZQS72y9tr1OdN+C18aZhSnaKD4qvARk ON8O3LoDi1GI6kHqi2zp9EffsH0I8Unnuj8o5d9okMjO2A7o4Gii4/Rnxkacu0sE/bee 6ut2+Y3yBfCEUgkmR8T37//hH2eN3Hl79rnLW5hZjbPtufQEpqkuQgFYuInlK8YyIySb MLyFwFIAxXub9yqDpHFzxbnx11cq6LXGYyb659lTo1NLUWDByJDapTj7K707yXrfwpkf QuiL2BC3bPGVEnz66NSwctTasL8GmjTBWDxoP/9zW6KhvGjSl2SkBJXPGyLb+3/AXqbT dePQ== MIME-Version: 1.0 X-Received: by 10.107.16.31 with SMTP id y31mr27994546ioi.53.1426348615018; Sat, 14 Mar 2015 08:56:55 -0700 (PDT) In-Reply-To: References: <5501be8b$0$13006$c3e8da3$5496439d@news.astraweb.com> <87twxqqewm.fsf@elektro.pacujo.net> <4eec1709-dd11-4891-bfcc-60b27bb00ee3@googlegroups.com> <550259bf$0$12975$c3e8da3$5496439d@news.astraweb.com> <00d9152a-f391-4c64-b2bd-52bdec2a6b67@googlegroups.com> <8761a5s0he.fsf@elektro.pacujo.net> <5503cf5f$0$12985$c3e8da3$5496439d@news.astraweb.com> Date: Sun, 15 Mar 2015 02:56:54 +1100 Subject: Re: generator/coroutine terminology 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.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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1426348617 news.xs4all.nl 2833 [2001:888:2000:d::a6]:33381 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87424 On Sun, Mar 15, 2015 at 2:29 AM, Rustom Mody wrote: > However a "generator function" is a weird sort of function (at best). > Not regarding it as a function is IMO more reasonable. But it *is* a function. You call it, possibly with positional and/or keyword arguments, and you get back a returned object. How is this different from any other function? (Yes, by this definition a class could be called an "object function". But the line is already somewhat blurry; if I've read my history correctly, "int" used to be a function, but now it's a type. A class is really just a special type of factory function, just as a generator function is.) ChrisA