[Python-Dev] Re: closure semantics

David Eppstein eppstein at ics.uci.edu
Wed Oct 22 00:11:24 EDT 2003


In article <200310220314.h9M3Euk11066 at oma.cosc.canterbury.ac.nz>,
 Greg Ewing <greg at cosc.canterbury.ac.nz> wrote:

> Guido:
> 
> > >     def inner():
> > >        outer.x = 42
> > 
> > Because this already means something!
> 
> Hmmm, maybe
> 
>    x of outer = 42
> 
> Determined-to-get-an-'of'-into-the-language-somehow-ly,

scope(outer).x = 42

Almost implementable now by using the inspect module to find the first 
matching scope, except that inspect can't change the local variable 
values, only look at them.

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-Dev mailing list