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

Nick Coghlan ncoghlan at gmail.com
Mon Sep 26 19:01:17 CEST 2011

On Mon, Sep 26, 2011 at 11:45 AM, Mike Meyer <mwm at mired.org> wrote:
> When this conversation started discussing namespaces, it occurred to me that
> we've had a number of suggestions for "statement-local" namespaces shot
> down. It seems that they'd solve this case as well as the intended case. I
> don't expect this to be acceptable, but since it solves part of this problem
> as well as dealing with the issues for which it was originally created, I
> thought I'd point it out.

See PEP 3150 - I've written fairly extensively on the topic of
statement local namespaces, including their potential application to
this use case :)

There are some fairly significant problems with the idea, which are
articulated in the PEP. If you'd like to discuss it further, please
start a new thread so this one can stay focused on the more limited
'nonlocal' suggestion.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list