generator/coroutine terminology

Rustom Mody rustompmody at gmail.com
Thu Mar 12 22:23:12 EDT 2015


On Thursday, March 12, 2015 at 11:25:32 PM UTC+5:30, Marko Rauhamaa wrote:
> Rustom Mody :
> 
> > I guess we need
> > 1. A clear ontology of the base concepts (which is a buzzword for
> > nailed-down terminology)
> 
> According to the documentation, a function whose definition contains a
> yield statement is a generator:
> 
>    Using a yield expression in a function's body causes that function to
>    be a generator.
> 
>    <URL: https://docs.python.org/3/reference/expressions.html#yield-exp
>    ressions>
> 
>    generator
>       A function which returns an iterator.
> 
>    <URL: https://docs.python.org/3/glossary.html#term-generator>
> 
> Apparently, what we have here is a discrepancy between the documentation
> and the CPython implementation.
> 
> In a word, it's a bug (somewhere).

Throwing out some thought for better terminology.
[Yeah needs to be chewed on a bit...]

With respect to my example above:

def foo(x):
   yield x+1
   yield x+2


g = foo(2) 

Generator-instance: g
Generator-factory: foo
Generator: Concept in python (ontology) elaborated in terms of the above

Situation with coroutines is worse
[Or I cant think of good terms...]



More information about the Python-list mailing list