Tal Einat <[email protected]> added the comment:
To clarify, to my understanding the issue here is that when using a class as a
decorator, and copying the wrapped function's __doc__ to self.__doc__ in
__init__, help() will pick up the wrapper class's __doc__ rather than the
instance's __doc__.
For example:
class Deco:
"A decorator."
def __init__(self, func):
functools.update_wrapper(self, func)
def __call__(self, *args, **kwargs):
pass
@Deco
def double(n):
"A function."
return n * 2
help(double) will show "A decorator." rather than "A function." despite the use
of functools.update_wrapper().
----------
nosy: +taleinat
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue29940>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com