On Jan 12, 2015 6:47 AM, "Albert-Jan Roskam" <fo...@yahoo.com> wrote:
> Thanks for your replies. I changed it into a regular decorator (not a class 
> decorator). It would have been even nicer if I only needed to specify it once 
> per class, but, well, in my case this hardly matters. The code below works as 
> intended. One problem (not specific to the code): the decorator destroys the 
> signature: it always becomes "*args, **kwargs"). This is annoying with 
> help(), but what worries me most is that my Sphinx documentation is also 
> affected. The information about the defaults gets lost (the parameters are 
> decribed in the docstring, but not the defaults). That kind of sucks. Is 
> there a builtin way around this (in other words: I am aware of this package: 
> https://pypi.python.org/pypi/decorator). I am hoping to get the code working 
> on Python 2.7 and 3.3 and up.

As of (I think) 3.4 pydoc and the help() function will show you the
signature of the wrapped function as long as you use functools.wraps.
I don't know what the status is for Sphinx; all I can offer is this
stackoverflow link.

http://stackoverflow.com/questions/3687046/python-sphinx-autodoc-and-decorated-members
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to