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

Nick Coghlan ncoghlan at gmail.com
Fri Sep 30 21:21:46 CEST 2011

On Fri, Sep 30, 2011 at 3:01 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> On Fri, Sep 30, 2011 at 5:07 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> <disclaimer>
> I'll admit that I may have gotten some of this wrong, not having years
> of experience to back me up here.  So I definitely defer to knowledge
> of Nick, et al.  I have been pretty immersed in this stuff for several
> months and the above is my resultant perspective, that of someone who
> has dived in without a lot of background in it. :)
> </disclaimer>

Heh, it's not like all this is something that comes up every day - the
compiler and eval loop mostly sit in the corner chugging away quietly
without bothering anyone. The main advantage of experience is knowing
what all the moving parts are and where in the code base to look to
refresh my recollection of any details I've forgotten :)

The only comment I'd make about your explanation is that a lot of
those details aren't actually part of the language spec - they're
implementation details of CPython that other implementations may
happen to follow because it's a reasonable way to do things. They can
still be a useful intuition pump in helping to figure out what is and
isn't feasible in the language design, though.


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

More information about the Python-ideas mailing list