[Python-Dev] Explicit Lexical Scoping (pre-PEP?)
Just van Rossum
just at letterror.com
Wed Jul 5 12:54:07 CEST 2006
Guido van Rossum wrote:
> Hallo broer! :-)
Yo :)
> I wonder what this should mean then:
>
> def outer():
> def inner():
> x := 1
>
> What is x's scope?
UnboundVariableError: variable 'x' referenced before assignment
Or a SyntaxError if the compiler can detect it.
> Also, a := operator allows all sorts of left-hand sides that don't
> necessarily make sense, e.g.
>
> x.foo := 1
> x[0] := 1
True, although maybe they could be made to make sense by defining
special methods:
__rebindattr__
__rebinditem__
<0.5 wink>
Just
More information about the Python-Dev
mailing list