[Python-Dev] Re: closure semantics

Alex Martelli aleaxit at yahoo.com
Sun Oct 26 06:01:30 EST 2003

On Saturday 25 October 2003 17:49, Paul Moore wrote:
> However, one significant issue with your notation scope(outer).x = 23
> is that, although scope(outer) *looks like* a function call, it isn't
> - precisely because scope is a keyword.
> I think that, if you're using a keyword, you need something
> syntactically distinct. Now maybe you can make something like

Existing operator keywords, such as, e.g., 'not', get away without
it.  One can use parentheses, write not(x), or not (preferable style);
and what's the problem if "not(x)" CAN indeed look like a function
call while in fact it's not?  I really makes no deep difference here
that 'not' is a keyword and not a built-in function (it does matter
when it's used with other syntax, of course, such as "x is not y"
or "x not in y" or "not x" and so on -- but then, where 'scope' to
be introduced, it, too, like other operator keywords, might admit
of slightly different syntax uses).

Similarly, that 'scope' is a keyword known to the compiler is not
deeply important to the user coding scope(f) -- it might as well
be a built-in, from the user's viewpoint.  It's important to the
compiler, it becomes important if the user erroneously tries to
rebind "scope = 23", but those cases don't give problems.


More information about the Python-Dev mailing list