[Python-ideas] Tweaking closures and lexical scoping to include the function being defined
ron adam
ron3200 at gmail.com
Fri Sep 30 05:40:34 CEST 2011
On Thu, 2011-09-29 at 22:35 -0500, Ron Adam wrote:
> That looks fine to me.
>
>
>
> def set_this(f):
> kwds = {'__this__':f}
> f = type(f)(f, closure={'__this__':f)
> return f
>
> This decorator won't work as the function '__this__' points to is the
> old function, the new one hasn't been created yet. Hmmm.
Correct that too...
def set_this(f):
f = type(f)(f, closure={'__this__':f})
return f
It still won't work, for the reasons stated.
> Cheers,
> Ron
More information about the Python-ideas
mailing list