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

Bruce Leban bruce at leapyear.org
Mon Sep 26 19:32:40 CEST 2011


On Mon, Sep 26, 2011 at 10:16 AM, Devin Jeanpierre
<jeanpierreda at gmail.com>wrote:

> > The keyword nonlocal means that this binding is not local to this scope
> but
> > can be found up the call stack.
>
> Lexical stack. (The call stack would be dynamic scope. [I suspect you
> already know this; I am pedant
>

Yeah, I know that but a perfect example of how easy it is to get confused.
:-)

>
> > In contrast, your usage means the binding is
> > local to this function, created before the function is called the first
> time
> > and shared with all calls to this function. Those are orthogonal scopes.
>
> Not really. Created differently, yes. But after creation it works
> identically, by definition.
>

To a python developer, sure. To a python programmer, I don't think so.

--- Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110926/3d2b081f/attachment.html>


More information about the Python-ideas mailing list