Benjamin Peterson <benja...@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 <rep...@bugs.python.org> <http://bugs.python.org/issue7423> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com