generator/coroutine terminology

Marko Rauhamaa marko at pacujo.net
Fri Mar 13 05:36:13 EDT 2015


Rustom Mody <rustompmody at gmail.com>:

> Nice demo of the same confusing terminology we are talking about.

Why don't you just stick with the terminology of the language
specification? I think your students are going to be more confused if
you try to come up with something better.

> When I say "expect generators to close" I mean 'generator-instances'
> ie at runtime
>
> When you say "expect both to close with return" you are talking of
> program-texts ie the 'factory'
>
> [Or I am guilty of the same I am accusing python of]

Your 'factory' is a:

    generator
        A function which returns an iterator.
    <URL: https://docs.python.org/3/glossary.html>

Your 'generator-instance' is an:

    iterator
        An object representing a stream of data.
    <URL: https://docs.python.org/3/glossary.html>

I don't think you should read much into what str(obj) returns. It's not
much more than a random printable some CPython coder has cooked up in
the heat of the moment.


Marko



More information about the Python-list mailing list