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

Guido van Rossum guido at python.org
Fri Oct 3 22:58:47 CEST 2008


On Fri, Oct 3, 2008 at 3:37 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> However, it's not lambda that's broken, it's the for loop.

I disagree. If you propose to change the for-loop to create new cells,
you would also need to introduce new syntax for introducing new cells
in other contexts. While it is common (especially when demonstrating
the problem) to use a for loop variable in the lambda, the same
problem exists when the variable referenced is constructed via other
means.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-ideas mailing list