explicit variable scoping

Sean Ross sross at connectmail.carleton.ca
Tue Mar 23 16:37:40 CET 2004


"Jacek Generowicz" <jacek.generowicz at cern.ch> wrote in message
news:tyfk71b66ko.fsf at pcepsft001.cern.ch...

> In Python, both "let" and "setq" are spelt "=". However, in the case
> of a global binding "(setq x y)" can be spelt "global x; x = y".
>
> "let" and "setq" give us a way to express whether we want to rebind an
> existing binding, or to create a new one.

Io makes a similar distinction, though "let" and "setq" are spelled
differently (":=" and "=", respectively). Their rationale can be found
here [1]. They don't appear to have considered 'let', e.g., "let a = 1".

On a somewhat related note, there's atleast one long debate [2] on
c.l.py regarding adding ":=" to the language (there are others if anyone
wants to sift through the archives). Although, that argument was about
adding an assignment expression, not a second assignment statement.




[1]
http://io.kicks-ass.net/LocalVariables

http://io.kicks-ass.net/LocalVariablesSolutions

[2]
http://groups.google.ca/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=Pine.SUN.3.95-heb-2.07.990511232428.3549B-100000%40sunset.ma.huji.ac.il






More information about the Python-list mailing list