[issue23764] functools.wraps should be able to change function argspec as well

Nick Coghlan report at bugs.python.org
Thu Mar 26 00:55:12 CET 2015


Nick Coghlan added the comment:

Regarding the PyPI decorator module, the difference there is between using a "def f(*args, **kwargs)" wrapper (which requires following wrapper chains to read the signature correctly) and using functools.partial (which reports the correct surface signature directly).

You can define your own wrapper decorators like this to reproduce that behaviour with standard library components:

  def wrapper(func):
    return functools.wraps(func)(functools.partial(func))

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23764>
_______________________________________


More information about the Python-bugs-list mailing list