PEP 289: Generator Expressions (please comment)

Skip Montanaro skip at pobox.com
Fri Oct 24 09:30:34 EDT 2003


    >> I too prefer the above use of yield because then you can always
    >> associate generators with the yield keyword.

    Rainer> I don't, because using 'yield' here would lead to greater
    Rainer> confusion when using generator expressions in generator
    Rainer> functions.

There's also the mental confusion about what the yield is doing.  Is it
yielding a value back from the function containing the generator expression
or yielding values from the generator expression to the current function?
One of the earliest proposals on python-dev used the yield keyword.  I fell
into this exact hole.  It took a message or two from others participating in
the thread to extricate myself.

Skip





More information about the Python-list mailing list