[Python-ideas] Tweaking closures and lexical scoping to include the function being defined

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 27 01:35:09 CEST 2011


Paul Moore wrote:

> Your argument that this is a simple extension of the semantics of
> "nonlocal" is reasonable when viewing nonlocal in terms of lifetimes.
> My contention is that most people view nonlocal in terms of visibility
> (and in that view, the two uses of nonlocal are jarringly dissimilar).

Same here. What's more, when I think about what 'nonlocal' means
at a conceptual level, I'm not thinking about cells attached to
function objects. I'm thinking about reaching out to something
pre-existing outside of the function. In contrast, the proposed
feature would be creating something new, and putting it somewhere
that the programmer can't even see.

 > But readability matters, and I worry that this isn't "readable". Maybe
 > the fact that neither of us is Dutch is relevant here, too :-)

But Guido doesn't appear to like it either, so Dutchness does not
seem to be a sufficient condition for appreciating this brand of
logic. :-(

-- 
Greg



More information about the Python-ideas mailing list