Hacker News new | ask | show | jobs
by chishaku 3743 days ago
> One interesting side-thing with list comprehensions

Just to clarify, this is the behavior of py2 for loops in general, whether in a comprehension or not.

1 comments

Except dictionary comprehensions don't leak their variables.
Probably because dict comprehensions were introduced as a 3.0 feature, and put into 2.7 since that version is designed to be a bridge to 3.0.

(They were actually proposed a long time ago, it was decided not to add them, but the decision changed to add them for 3.0)