loop scope

Greg Ewing (using news.cis.dfn.de) wmwd2zz02 at sneakemail.com
Sun Mar 14 19:56:02 EST 2004


Jacek Generowicz wrote:
> now simply add list comprehensions (or
> loops), and you will maintain perfect consistency of treatment of
> local variables,

It wouldn't do to make the whole (non-comprehension)
for-loop a new scope, because that would make any
variables assigned within the loop body local as well.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list