[issue7423] nested generator expression produces strange results

Benjamin Peterson report at bugs.python.org
Wed Dec 2 02:55:49 CET 2009


Benjamin Peterson <benjamin at python.org> added the comment:

By using a generator expression, you are deferring evaluation of the
expression until map() is actually invoked. By that time, the closure
over 'x' has been changed to 'b', so when the genexp is forced, 'x'
yields 'b' each time.

----------
nosy: +benjamin.peterson
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7423>
_______________________________________


More information about the Python-bugs-list mailing list