Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #87448
| Path | csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <oscar.j.benjamin@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.030 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'else:': 0.03; 'context': 0.07; 'function:': 0.09; 'thats': 0.09; 'type,': 0.09; 'cc:addr :python-list': 0.11; 'def': 0.12; "wouldn't": 0.14; 'cc:name:python list': 0.16; 'dislike': 0.16; 'distinct': 0.16; 'evaluates': 0.16; 'expressions.': 0.16; 'generator.': 0.16; 'informal': 0.16; 'iterator': 0.16; 'naming': 0.16; 'subject:generator': 0.16; 'thursday,': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'written': 0.21; 'seems': 0.21; 'cc:addr:python.org': 0.22; 'case.': 0.24; 'fine': 0.24; 'cc:2**0': 0.24; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'function': 0.29; 'statement': 0.30; 'message- id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'steven': 0.31; 'though.': 0.31; 'anyone': 0.31; 'probably': 0.32; 'url:python': 0.33; 'sources': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'yield': 0.36; 'possible': 0.36; 'url:org': 0.36; 'should': 0.36; 'clear': 0.37; 'being': 0.38; '12,': 0.39; 'bad': 0.39; 'expression': 0.60; 'new': 0.61; 'march': 0.61; 'url:3': 0.61; 'simple': 0.61; 'term': 0.63; 'kind': 0.63; 'teaching': 0.64; 'different': 0.65; 'to:addr:gmail.com': 0.65; 'between': 0.67; 'below:': 0.68; 'subject': 0.69; 'results': 0.69; 'containing': 0.69; 'special': 0.74; '2015': 0.84; 'improved.': 0.84; 'oscar': 0.84; 'url:reference': 0.84; 'mean.': 0.91; 'whereas': 0.91 |
| 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 :cc:content-type; bh=1ciULJU/ejpv8flbctqUXbXElRXmGixdO3Hqu/Vwdto=; b=z4WXrXlFf6zleJ0eH8bS1OfAgsf81aXRto0jE9OTIFbD/5bMy7SEPqm6WQtIbDvo8A mCCXzDfzvq58ShCJ8TPyGulABOLHsaXmLVh8wbkZd/GTE9ahGrXepoL5mvdN4xw+tbvP y0lHFu3uF8S4qelYQ0/LD08Yq1Nrbv53V17mLPr9sAP/tm+f35qs3vgYRB6GSaeM7yBY 99GOwoo2gYPXA8GpziER6IvFw3KTG1auAH0QYxU3mzLE6jXXgyC+CRsLs6xYnLzamGD+ ssO0vulZb3QYAg8XwiCUoq+KP93RtX/M6TWscD8tHKVngMi12HjvE4Xv4GC6MdXIFWCW +c8g== |
| X-Received | by 10.194.110.69 with SMTP id hy5mr111369221wjb.121.1426370542305; Sat, 14 Mar 2015 15:02:22 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <ccd600f8-672e-4993-adb8-d007b521a110@googlegroups.com> |
| References | <ff0bc8eb-63e4-40ea-8d31-301625a3d470@googlegroups.com> <5501be8b$0$13006$c3e8da3$5496439d@news.astraweb.com> <ccd600f8-672e-4993-adb8-d007b521a110@googlegroups.com> |
| From | Oscar Benjamin <oscar.j.benjamin@gmail.com> |
| Date | Sat, 14 Mar 2015 22:02:02 +0000 |
| Subject | Re: generator/coroutine terminology |
| To | Rustom Mody <rustompmody@gmail.com> |
| Cc | Python List <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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.376.1426370550.21433.python-list@python.org> (permalink) |
| Lines | 70 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1426370550 news.xs4all.nl 2921 [2001:888:2000:d::a6]:58152 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:87448 |
Show key headers only | View raw
On 12 March 2015 at 16:52, Rustom Mody <rustompmody@gmail.com> wrote:
>
> On Thursday, March 12, 2015 at 9:58:07 PM UTC+5:30, Steven D'Aprano wrote:
>> Rustom Mody wrote:
>>
>> >
>> > Say I have a simple yielding function:
>> >
>> > def foo(x):
>> > yield x+1
>> > yield x+2
>> >
>> > And I have
>> >
>> > g = foo(2)
>> >
>> > If I look at type, g's type is 'generator' whereas foo is just plain-ol
>> > 'function.'
>> >
>> > Whereas in informal usage we say foo is a generator.
>>
>> Hopefully it is clear from context what we actually mean. When in doubt, we
>> should be explicit.
>
> There is a very important 'context' where both have to exist together -- teaching beginners.
It is definitely important to draw the distinction between a generator
function and a generator in teaching. I would use distinct terminology
in any case. It's also important where possible to use the same
terminology as is used in the various different sources of
documentation that your students will encounter so inventing a new
term like "generator factory" is probably a bad idea.
> foo's are written to produce g's. g's come from foo-like.
>
> Better naming would help clarify -- your 'factory' is the best Ive seen so far.
I dislike the term "generator factory". To me it suggests something
like foo below:
def baz():
yield 4
def bar():
yield 6
yield 7
def foo(x):
if x > 4:
return baz()
else:
return bar()
The existing terminology seems fine to me: A generator function is a
special kind of function containing a yield statement that always
returns a generator. A generator expression is a special kind of
expression that evaluates to a generator. A generator is a special
type of iterator that results from generator functions and generator
expressions.
> But the docs?!?! Hoo Boy My head spins trying to grok this
> https://docs.python.org/3/reference/expressions.html#generator-expressions
> And thats after being familiar with the origins of the idea in
> scheme/simula/CLU etc.
Perhaps the docs can be improved. I wouldn't recommend that particular
page to anyone who wasn't already familiar with the subject though.
Oscar
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-12 06:35 -0700
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-03-13 00:55 +1100
Re: generator/coroutine terminology breamoreboy@gmail.com - 2015-03-12 06:57 -0700
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-13 03:27 +1100
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-12 09:52 -0700
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-12 19:55 +0200
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-12 19:23 -0700
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-13 14:30 +1100
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-12 22:28 -0700
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-03-13 19:23 +1100
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-13 02:12 -0700
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-13 11:36 +0200
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-14 17:04 +1100
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-14 09:54 +0200
Re: generator/coroutine terminology Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-14 08:04 +0000
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-14 10:30 +0200
Re: generator/coroutine terminology Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-14 14:14 -0600
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-14 21:15 -0700
Re: generator/coroutine terminology Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-14 20:31 +0000
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-14 08:29 -0700
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-03-15 02:56 +1100
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-14 08:59 -0700
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-03-15 03:14 +1100
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-14 09:33 -0700
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-03-15 03:51 +1100
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-14 10:17 -0700
Re: generator/coroutine terminology Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-14 16:56 +0000
Re: generator/coroutine terminology Dave Angel <davea@davea.name> - 2015-03-14 13:07 -0400
Re: generator/coroutine terminology albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-03-31 12:57 +0000
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-15 19:37 +1100
Re: generator/coroutine terminology CHIN Dihedral <dihedral88888@gmail.com> - 2015-04-18 11:07 -0700
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-03-13 22:32 +1100
Re: generator/coroutine terminology Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-03-14 22:02 +0000
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-15 00:15 +0200
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-03-15 09:24 +1100
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-15 02:15 +0200
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-03-15 11:22 +1100
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-15 02:48 +0200
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-03-15 13:02 +1100
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-16 12:03 +1100
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-16 09:12 +0200
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-03-16 18:21 +1100
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-16 09:40 +0200
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-16 22:59 +1100
Re: generator/coroutine terminology Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-16 01:37 -0600
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-16 09:52 +0200
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-16 23:02 +1100
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-16 14:42 +0200
Re: generator/coroutine terminology Jonas Wielicki <jonas@wielicki.name> - 2015-03-16 13:39 +0100
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-16 19:36 +1100
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-03-16 19:58 +1100
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-16 22:51 +1100
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-03-17 00:16 +1100
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-16 14:32 +0200
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-16 05:51 -0700
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-16 15:13 +0200
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-17 01:32 +1100
Re: generator/coroutine terminology Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-16 08:45 -0600
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-17 00:39 +1100
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-16 07:19 -0700
Re: generator/coroutine terminology Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-16 14:26 +0000
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-16 07:37 -0700
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-16 07:55 -0700
Re: generator/coroutine terminology Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-16 18:19 +0000
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-16 19:52 -0700
Re: generator/coroutine terminology Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-17 03:07 +0000
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-16 20:18 -0700
Re: generator/coroutine terminology Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-17 03:25 +0000
Re: generator/coroutine terminology Rustom Mody <rustompmody@gmail.com> - 2015-03-16 20:33 -0700
Re: generator/coroutine terminology Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-17 03:55 +0000
Re: generator/coroutine terminology Mario Figueiredo <marfig@gmail.com> - 2015-03-17 04:22 +0100
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-17 01:35 +1100
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-17 01:36 +1100
Re: generator/coroutine terminology Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-16 08:52 -0600
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-16 17:09 +0200
Re: generator/coroutine terminology Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-16 09:26 -0600
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-16 18:05 +0200
Re: generator/coroutine terminology albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-03-31 13:18 +0000
Re: generator/coroutine terminology Dave Angel <davea@davea.name> - 2015-03-31 09:38 -0400
Re: generator/coroutine terminology albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-03-31 15:03 +0000
Re: generator/coroutine terminology Chris Angelico <rosuav@gmail.com> - 2015-04-01 02:36 +1100
Re: generator/coroutine terminology Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-03 17:02 +1100
Re: generator/coroutine terminology albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-04-18 17:52 +0000
Re: generator/coroutine terminology Paul Rubin <no.email@nospam.invalid> - 2015-04-02 23:46 -0700
Re: generator/coroutine terminology Terry Reedy <tjreedy@udel.edu> - 2015-03-12 16:11 -0400
Re: generator/coroutine terminology Marko Rauhamaa <marko@pacujo.net> - 2015-03-12 22:22 +0200
csiph-web