Andreas Tawn wrote:
I never knew that and I can't find reference to it in the docs.
the for-in loop does ordinary assignments in the current scope:
http://docs.python.org/ref/for.html
"Each item in turn is assigned to the target list using the
standard rules for assignments, and then the suite is executed."
somewhat simplified, "for vars in expression: code" is equivalent to
inlining:
_ = iter(expression)
while 1:
try:
vars = _.next()
except StopIteration:
break
else:
body
where "_" is an internal variable.
</F>
--
http://mail.python.org/mailman/listinfo/python-list