[Python-ideas] For-loop variable scope: simultaneous possession and ingestion of cake
Terry Reedy
tjreedy at udel.edu
Sat Oct 4 14:18:23 CEST 2008
Greg Ewing wrote:
> Neil Toronto wrote:
>
>> Python could close over the values rather than a cell. That's *almost
>> always* what people really care about anyway! It'd break almost no code.
>
> No, it would break huge amounts of code. Consider
Something we seem to agree on ...
>
> def f():
> g()
>
> def g():
> print "Gee"
>
> Would you really like to get a NameError or
> UnboundLocalError on g here?
I believe all (apparently) recursive functions would have the same problem.
More information about the Python-ideas
mailing list