[Python-Dev] Re: Candidate Function Decorator

Terry Reedy tjreedy at udel.edu
Tue Apr 13 13:40:27 EDT 2004


"Raymond Hettinger" <raymond.hettinger at verizon.net>  [cc'ed]:

>I worked out the details for binding constants and posted a recipe
      http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/277940

I have the impression that it is proposed that the function f will *not*
yet be bound to its name (f.func_name) in its environment at the time the
decorator is called.  If so, f.func_name will not appear in env unless you
separately add it.  If you do add it, then I would think that recursive
functions would be bound to themselves and recursive calls would also go
faster, just as with calls to builtins, etc.

The only obvious downside to me is that the circular ref would keep
function around until gc'ed, but that is why gc was added ;-).

Terry J. Reedy






More information about the Python-Dev mailing list