Something is rotten in Denmark...
Martin Manns
mmanns at gmx.net
Tue May 31 20:57:52 EDT 2011
On Tue, 31 May 2011 15:47:33 -0600
Ian Kelly <ian.g.kelly at gmail.com> wrote:
> The i variable is part of the global scope, and as you iterate over
> range(10) again it coincidentally takes on the same values as in the
> original list comprehension. You don't see this in Python 3 because
> the scope of i is limited to the list comprehension, not global.
I read about the scope change.
However, list comprehension scope being global still feels "right" for
me because I am still using Python 2.
I feel that I should start worrying more about future migration issues.
Cheers
Martin
More information about the Python-list
mailing list