[Python-Dev] dealing with decorators hiding metadata of decorated functions

Josiah Carlson jcarlson at uci.edu
Sat Mar 18 01:18:22 CET 2006


"Brett Cannon" <brett at python.org> wrote:
> 
> With the discussion of a possible @decorator to help set the metadata
> of the decorator to that of what the wrapped function has, I had an
> idea that I wanted to toss out there (this dicussion stems from a blog
> post I made: http://sayspy.blogspot.com/2006/03/how-to-handle-object-identity-issues.html).

[snip]

Edward Loper suggested this way back on September 5, 2004.

    http://mail.python.org/pipermail/python-dev/2004-September/048626.html

I was and continue to be +1 on this, though I would go farther and state,
like I did at the time, that one shouldn't copy any of the function
attributes, they should come 'free', similar to the way that class
attributes are 'free' on subclasses.

    http://mail.python.org/pipermail/python-dev/2004-September/048631.html

What would make this _really_ nice is if one didn't need to do anything
manually; that the attribute that pointed to the decorated
function/object would be automatically applied - though I realize that
this may not be generally possible.

 - Josiah



More information about the Python-Dev mailing list