[Python-Dev] closure semantics

Greg Ewing greg at cosc.canterbury.ac.nz
Thu Oct 23 23:26:34 EDT 2003


Joshua Marshall <jmarshal at mathworks.com>:

> I'd like to suggest "outer v" for this.

We've been assuming all along that the semantics of a
plain "global" statement have to remain exactly as they
are, but is that strictly necessary?

How much hardship would it cause, really, if "global"
were simply redefined to mean "the next scope out where
it's bound"?

It would only break something if "global" were used in
a nested function *and* there were a variable with the
same name in some intermediate scope. That sounds like
a rather rare set of conditions to me. Not significantly
more common than "yield" being used as a variable name,
surely?

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list