[Python-Dev] PEP for Better Control of Nested Lexical Scopes

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Feb 23 05:27:21 CET 2006

Almann T. Goo wrote:

 > (although rebinding a name in the global scope from a
> local scope is really just a specific case of that).

That's what rankles people about this, I think -- there
doesn't seem to be a good reason for treating the global
scope so specially, given that all scopes could be
treated uniformly if only there were an 'outer' statement.
All the arguments I've seen in favour of the status quo
seem like rationalisations after the fact.

 > Since there were no nested lexical scopes back
> then, there was no need to have a construct for arbitrary enclosing
> scopes.

However, if nested scopes *had* existed back then, I
rather suspect we would have had an 'outer' statement
from the beginning, or else 'global' would have been
given the semantics we are now considering for 'outer'.

Of all the suggestions so far, it seems to me that
'outer' is the least radical and most consistent with
what we already have. How about we bung it in and see
how it goes? We can always yank it out in 3.0 if it
turns out to be a horrid mistake and we get swamped
with a terabyte of grievously abusive nested scope
code. :-)

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiam!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list