define "generator" (glossary bug?)

Jean-Paul Calderone exarkun at divmod.com
Fri May 22 13:07:57 EDT 2009


On Fri, 22 May 2009 16:38:40 GMT, Alan G Isaac <alan.isaac at gmail.com> wrote:
>I believe the glossary
>http://wiki.python.org/moin/PythonGlossary
>is missing the definition for 'generator'
>and has used instead the definition for 'generator function',
>which term is missing from the glossary.
>
>Standard usage as I understand it is found here:
>http://docs.python.org/3.0/reference/simple_stmts.html#the-yield-statement
>

Well, it seems someone edited the wiki since you sent your message, since
there is no longer an entry for "generator function", but instead one for
"generator".

However, I think it was right before.  Consider:

def foo():
    yield

Now, is `foo´ a generator?  If so, what is `foo()´?

With the "generator function"/"generator" terminology, it is unambiguous
to say "`foo´ is a generator function and `foo()´ is a generator".

Jean-Paul



More information about the Python-list mailing list