[Python-ideas] PEP 572 version 2: Statement-Local Name Bindings
rosuav at gmail.com
Sat Mar 17 03:13:18 EDT 2018
On Sat, Mar 17, 2018 at 5:49 PM, David Foster <davidfstr at gmail.com> wrote:
> (3a) With a header-limited scope (in proposal #1 above), I advocate that a
> named expression should NOT be able to shadow other variables, giving a
> SyntaxError. I can't think of a reasonable reason why such shadowing should
> be allowed, and preventing shadowing may eliminate unintentional errors.
Header-limited scope is hard to define. Do you mean expression-local?
(Also hard to define.) Do you mean local to one line of source code?
Definitely not. And what happens with a 'for' loop - part of its
header gets run after each loop iteration but still kinda references
stuff that was done once-only before the loop started.
More information about the Python-ideas