[Python-ideas] PEP 572: Statement-Local Name Bindings, take three!
Tim Peters
tim.peters at gmail.com
Tue Mar 27 00:02:32 EDT 2018
[Guido]
> ...
> Not so fast. There's a perfectly reasonable alternative to sublocal scopes
> -- just let it assign to a local variable in the containing scope. That's
> the same as what Python does for for-loop variables.
That's certainly what I would _expect_ if I never read the docs,
conditioned by experience with Python's `for` and embedded assignments
in at least C and Icon.
But I have to confess I already gave up trying to stay up-to-date with
all of Python's _current_ scope rules. It's not what I want to think
about. It's easier all around to try not to reuse names in clever
ways to begin with.
More information about the Python-ideas
mailing list