generator/coroutine terminology

Chris Angelico rosuav at gmail.com
Thu Mar 12 09:55:55 EDT 2015


On Fri, Mar 13, 2015 at 12:35 AM, Rustom Mody <rustompmody at gmail.com> wrote:
> 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.
>
> So the question:
> What should we call foo and what should we call g?

g is a generator object; foo is a generator function - a function
which returns generator objects. Usually, calling both of them
"generators" isn't confusing, as there's not often any context in
which they're ambiguous.

ChrisA



More information about the Python-list mailing list