explicit variable scoping

Sean Ross sross at connectmail.carleton.ca
Tue Mar 23 11:38:33 EST 2004


"Sean Ross" <sross at connectmail.carleton.ca> wrote in message
news:7rZ7c.11361$A_2.694679 at news20.bellglobal.com...

>
> Or, perhaps ":=" :
>
> d := 1
> e := 9
> def f():
>     a, b := None, 3
>     b = 4 # rebind
>     d = 5 # raise error, should be "d := 5"
>    def g():
>        e = 10  # global assignment
>        b = 5  # rebind b in f
>        a := 7  # new local binding
>     print a, b, e  # will print None 5 10
>
>

Also

variable := init_value
varaible = update_value  # raise error, "name 'varaible' undeclared"





More information about the Python-list mailing list