generator/coroutine terminology

Terry Reedy tjreedy at udel.edu
Thu Mar 12 16:11:21 EDT 2015


On 3/12/2015 9:35 AM, Rustom Mody wrote:
> This is more a question about standard terminology/conventions than about semantics - of course assuming I understand :-)
>
> Say I have a simple yielding function:
>
> def foo(x):
>     yield x+1
>     yield x+2

This is a generator function

> 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.

I do not, because it does cause confusion, in spite of denials by people 
who use 'generator' ambiguously.

-- 
Terry Jan Reedy




More information about the Python-list mailing list