[BangPypers] list comprehensions and generator expressions in Python 3

Anand Chitipothu anandology at gmail.com
Thu Feb 21 05:50:56 CET 2013


Hi,

PEP 289 says "the semantic definition of a list comprehension in
Python 3.0 will be equivalent to list(<generator expression>).

http://www.python.org/dev/peps/pep-0289/

I've just come across a bug reported by Peter Norvig, showing counterexamples.

http://bugs.python.org/issue14845

Very informative to understand the subtle differences between the
semantics of list comprehensions and generator expressions.

Anand


More information about the BangPypers mailing list