[Python-ideas] Generator/Coroutiine Ontology (was async/await in Python)
Rustom Mody
rustompmody at gmail.com
Sat Apr 18 06:48:35 CEST 2015
On Sat, Apr 18, 2015 at 12:28 AM, Yury Selivanov
<yselivanov.ml at gmail.com> wrote:
> Hello python-ideas,
>
> Here's my proposal to add async/await in Python.
>
> I believe that PEPs 380 and 3156 were a major breakthrough for Python 3,
I am also interested in this topic --- from the other side.
As a teacher of python it is my finding that the
terminology/documentation around generators is rather chaotic and
messy.
Basically given:
def foo():
yield 1
bar = foo()
what do we call foo and what do we call bar?
It is suggested that foo is "generator-function" and bar is "generator-object"
Unfortunately python does not aid this distinction; witness
>>> def foo():
... yield 1
...
>>> bar = foo()
>>> type(foo)
<class 'function'>
>>> type(bar)
<class 'generator'>
>>>
I asked about this on the python list
http://code.activestate.com/lists/python-list/682286/
And it seems that many more dark corners emerged in the docs on this
subject in that discussion.
Should I start a separate thread?
More information about the Python-ideas
mailing list