Docstring for a function whose signature was changed by a decorator
Answered
I have a reduce_with decorator like this:
def reduce_with(init):
def reduce_with_(f_):
@wraps(f_)
def wrapper(xs):
return reduce(f_, xs, init)
return wrapper
return reduce_with_
and I have defined an add function like this:
@reduce_with(0)
def add(x, y):
""" Get the sum of a list of numbers.
:param xs: a list of numbers
:return: the sum
"""
return x + y
Now PyCharm complains about missing parameters x, y and unexpected parameter xs in docstring.If I change the docstring to the way PyCharm wants it that would be misleading. How can I get rid of this message?
Please sign in to leave a comment.
Hello,
I reported issue on YouTrack: https://youtrack.jetbrains.com/issue/PY-28691
Please start following it to receive automatic notifications from YouTrack when the issue is updated.
See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.
Thank you.
You are welcome!