[Python-3000] end scope of iteration variables after loop

Nicholas T ntung at ntung.com
Thu Apr 17 02:52:11 CEST 2008


hello all,

   A few times in practice I have been tripped up by how Python keeps
variables in scope after a loop--and it wasn't immediately obvious what the
problem was. I think it is one of the ugliest and non-intuitive features,
and hope some others agree that it should be changed in py3k.

>>> for a in range(11): pass
...
>>> print(a)
10

Thanks,
Nicholas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20080416/c5ce7edd/attachment.htm 


More information about the Python-3000 mailing list