[Python-3000] Sky pie: a "var" keyword
jcarlson at uci.edu
Mon Oct 9 22:31:09 CEST 2006
"Marcin 'Qrczak' Kowalczyk" <qrczak at knm.org.pl> wrote:
> Josiah Carlson <jcarlson at uci.edu> writes:
> > From what I can tell, the only thing that your 'var' keyword does is
> > ambiguate the global vs. local case,
> No, it can select between any of outer scopes.
No. It can't select between *any* of the outer scopes, only those
scopes that have previously existing *names* that one wants to modify,
and really, only the deepest nested scope with a 'var' declaration.
It is no better, semantically, then just using a list. In fact, by
virtue of breaking currently working code, and making it visually
ambiguous, it is worse. As Jim Jewett stated, using a list "is at least
strange enough to warn people that they need to read carefully."
> It also allows to put globals in an array instead of a dictionary,
> making them as fast as locals.
No, it doesn't.
#foo.a didn't exist before
foo.a = x
#foo.a exists now
This kind of thing was stated in the earlier thread about making globals
as fast as locals.
More information about the Python-3000