[Python-Dev] "yield" in list comprehensions

Antoine Pitrou solipsis at pitrou.net
Fri Mar 27 16:58:18 CET 2009


Hello,

Just for the record, I thought I'd point out this slightly exotic and funny
incompatibility between 2.x and py3k. This is due to the fact that list
comprehensions now live in their own frame, so a "yield" expression inside a
list comprehension turns the comprehension itself into a generator (rather than
the enclosing function).

http://bugs.python.org/issue5577

Regards

Antoine.




More information about the Python-Dev mailing list