Comment
Comment by ot
Very interesting, I've been bitten by the same problem with Python once (capturing the iteration variable in a closure). To make things even worse, in Python the behaviour is inconsistent between list comprehensions and generator comprehensions:
The problem was not fixed even in Python 3. I don't know if there has been any discussion about it.