A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-March/062628.html below:

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

[Python-Dev] dealing with decorators hiding metadata of decorated functionsAahz aahz at pythoncraft.com
Sun Mar 19 22:37:27 CET 2006
On Sun, Mar 19, 2006, Brett Cannon wrote:
>
> I guess we need to decide if we want to promote the copying of
> metadata from the decorated function into the decorator or not.

Short answer: absolutely yes

I had to deal with a related issue recently, where embedded doctests no
longer worked on the decorated function.  There were two separate
problems: the first was non-copying of __doc__, which was easy enough to
fix; the second (which I still haven't fixed) is the fact that __name__
wasn't set, so doctest didn't auto-find the function.  (The decorator
came from a different module.)

(This was Python 2.2/2.3, so decorators weren't actually involved, but I
think it's the same problem.)

I don't understand decorators well enough to propose a good solution
given the other constraints, but it seems clear to me that we need a good
solution of some kind.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"19. A language that doesn't affect the way you think about programming,
is not worth knowing."  --Alan Perlis
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4