[Python-Dev] closure semantics

Jeremy Hylton jeremy at alum.mit.edu
Tue Oct 21 23:46:00 EDT 2003


On Tue, 2003-10-21 at 23:34, Barry Warsaw wrote:
> On Tue, 2003-10-21 at 23:00, Jeremy Hylton wrote:
> 
> > I would prefer to see a separate statement similar to global that meant
> > "look for the nearest enclosing binding."  Rather than specifying that
> > you want to use x from outer, you could only say you don't want x to be
> > local.  That means you'd always get intermediate.
> 
> Would those "up" bindings chain?

Yes.  If a block had an up declaration and it contained a nested block
with an up declaration for the same variable, both blocks would refer to
an outer binding.

Jeremy





More information about the Python-Dev mailing list