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

Ron Adam ron3200 at gmail.com
Sat Oct 1 23:15:31 CEST 2011


On Sat, 2011-10-01 at 20:27 +0100, Arnaud Delobelle wrote:

> Anyway, I've now lost track of how this relates to the subject of this thread :)

If a decorator can take the function name it is decorating, then Nicks
example of using a private name for recursion becomes easier to do.

According to pep316, it should be possible, but it's not implemented the
way the pep describes.

Also, if decorators are, or can be, implemented as a before compile
time, template translation, then these 'sugar' features wont make the
underlying core more complicated or complex.

And finally, decorator type 'template' solution may also work to create
closures.  (Without making the core more complex.)

Cheers,
   Ron





More information about the Python-ideas mailing list