Path: csiph.com!usenet.pasdenom.info!news.redatomik.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'programmer': 0.03; '16,': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'diff': 0.07; 'generators': 0.09; 'integers': 0.09; 'lawrence': 0.09; 'mess': 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; 'def': 0.12; 'bug': 0.12; 'wrote': 0.14; 'language.': 0.14; 'cleaned': 0.16; 'comp': 0.16; 'data)': 0.16; 'devs': 0.16; 'foo():': 0.16; 'iirc': 0.16; 'iterator': 0.16; 'lambda:': 0.16; 'patches': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:generator': 0.16; 'x()': 0.16; 'do,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'accepted.': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'certainly': 0.24; 'posts': 0.26; 'tracker': 0.26; 'subject:/': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'rest': 0.29; 'array': 0.29; 'raise': 0.29; 'url:wiki': 0.31; 'closer': 0.31; "d'aprano": 0.31; 'doc': 0.31; 'minor': 0.31; 'skip:= 20': 0.31; 'steven': 0.31; 'types.': 0.31; 'url:wikipedia': 0.31; 'lists': 0.32; 'text': 0.33; 'up.': 0.33; 'monday,': 0.33; 'plain': 0.33; 'core': 0.34; 'classes': 0.35; 'but': 0.35; 'scheme': 0.36; 'yield': 0.36; 'url:org': 0.36; 'list': 0.37; 'lists.': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'issue': 0.38; 'expect': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'march': 0.61; 'you.': 0.62; 'kind': 0.63; 'choose': 0.64; 'our': 0.64; 'provide': 0.64; 'between': 0.67; 'dont': 0.67; 'yes': 0.68; 'past.': 0.68; 'default': 0.69; 'url:%1': 0.72; 'special': 0.74; '(ie': 0.84; '2015': 0.84; 'perspective,': 0.84; 'lazy': 0.91; 'whereas': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: generator/coroutine terminology Date: Mon, 16 Mar 2015 14:26:23 +0000 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: host-78-147-190-141.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 In-Reply-To: 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: 63 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1426516017 news.xs4all.nl 2912 [2001:888:2000:d::a6]:39265 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87560 On 16/03/2015 14:19, Rustom Mody wrote: > On Monday, March 16, 2015 at 7:10:03 PM UTC+5:30, Steven D'Aprano wrote: >> And of course, from a comp science theoretic perspective, >> generators are a kind of subroutine, not a kind of type. > > You just showed Marko a few posts back, that > A generator is a special case of an iterator. > And you wrote the iterator with 'class'. > And from python 2.2(?) classes are types. > > So I dont know what "comp science theoretic perspective" you are describing... > > From mine: > > The generator > def gen(): > yield 1 > yield 2 > > is much closer to the list (ie data) [1,2] > than to say > > def foo(): > print 1 > print 2 > > The only difference is that the list memoizes the data whereas the generator doesn't. > > CLU perspective: > The iterator for a collection of complex_numbers can be used interchangeably with that for an array of integers > from https://en.wikipedia.org/wiki/CLU_%28programming_language%29 > [Note: CLU-iterator ≡ python-generator] > > Haskell perspective: > Lists are by default lazy and memoized. > IOW in Haskell: List ≡ Lazy list ≡ python generator + memoization > > Scheme perspective: > Programmer can choose between normal and lazy lists. > Lazy lists are just normal lists + delay/force where > delay x ≡ lambda: x > force x ≡ x() > > ====================== > Anyways... > > Yes 15 years are past. > I dont expect the def can be revoked now. > [As far as I am concerned its a minor wart] > But the mess around the docs can certainly be cleaned up. > So write the patches to correct the docs, then raise the issue on the bug tracker to get the patches accepted. IIRC for doc patches you don't even have to provide diff files against the rst files, plain text will do, the core devs will do the rest for you. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence