News for hackers. Stuff that matters.
Re:Python has brought computer programming to a vast new aud... by duckerude on Thursday July 19, 2018 @05:28PM (#17570448)
In Python 2, "[x for x in range(10)]; print(x)" prints 9. x is available outside the list comprehension.

In Python 3, it raises a NameError, because the x in "print(x)" is not defined. It's contained in the list comprehension.

But I don't know a good use of the Python 2 behavior.

There are no comments on this comment yet.