[Python-Dev] Explicit Lexical Scoping (pre-PEP?)

Mike Krell mbk.lists at gmail.com
Tue Jul 11 07:51:32 CEST 2006


On 7/10/06, skip at pobox.com <skip at pobox.com> wrote:

> I don't think the keyword should indicate a scope.
> I'd prefer it if LOAD_<WHATEVER> just percolated its way up the chain of
> cells (or could be identified at compile time by inspecting the AST as I
> think Guido intends) without the programmer having to name the binding
> scope.

I agree completely.  I realize that probably wasn't clear when I said
"it would be nice if the keyword indicated which scope was operative".
 I was really only trying to proffer a keyword which would hopefully
suggest to a newbie that they should percolate up the chain of scopes.
 In this sense, the word "outer" works for me, but I'm sympathetic to
Andrew Koenig's argument that "outer" is confusing because the
innermost binding is actually affected.

> Since it might not just be in the immediate parent scope, how about
> "ancestor"? <0.5 wink>

That thought had occurred to me, but then I beat it down with a stick :-)

My rationale was that the affected binding is the one seen by the
parent, even if the parent did not create the binding itself.

Greg Ewing's point about parent being a common variable name is
well-taken, though.

   Mike


More information about the Python-Dev mailing list