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

skip at pobox.com skip at pobox.com
Tue Jul 11 06:44:25 CEST 2006


    >> What's wrong with "nonlocal"?  I don't think i've seen an argument
    >> against that one so far (from Talin or others).

    Mike> It sounds a bit awkward to me.  Also, it would be nice if the
    Mike> keyword indicated which scope was operative.

Sounds awkward to me as well.  Couldn't put my finger on it until seeing
Jeremy's post though.  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.

Maybe if it names the function containing the variable to bind.  Nothing
static (like "up 3 levels") though.

    Mike> If I've followed the discussions correctly, I think the parent
    Mike> scope would be operative, so I humbly suggest "parent".

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

Skip



More information about the Python-Dev mailing list