PEP 289: Generator Expressions (please comment)
Rainer Deyke
rainerd at eldwood.com
Fri Oct 24 00:15:01 EDT 2003
Donald 'Paddy' McCarthy wrote:
> I too prefer the above use of yield because then you can always
> associate generators with the yield keyword.
I don't, because using 'yield' here would lead to greater confusion when
using generator expressions in generator functions.
yield [x for x in y] # Yields a list
yield x for x in y # Creates and discards a generator
yield yield x for x in y # Yields an iterator
--
Rainer Deyke - rainerd at eldwood.com - http://eldwood.com
More information about the Python-list
mailing list