[Python-ideas] For-loop variable scope: simultaneous possession and ingestion of cake

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Oct 4 04:56:21 CEST 2008

Guido van Rossum wrote:

> This leads me to reject claims that "the for-loop is broken" and in
> particular clamoring for fixing the for-loop without allowing us to
> fix this example.

Yeah, I never said the for-loop was the *only*
thing that's broken. :-)

Perhaps "broken" is too strong a word. What I really
mean is that it's designed in a way that interacts
badly with nested functions.

More generally, Python's inability to distinguish
clearly between creating new bindings and changing
existing bindings interacts badly with nested

I agree that the wider problem needs to be addressed
somehow, and perhaps that should be the starting
point. Depending on the solution adopted, we can
then look at whether a change to the for-loop is
still needed.


More information about the Python-ideas mailing list