I tried to prove you wrong and run multiple tests that all shown you were right. Then I tried to run them on different python versions, down to Python 2.7, expecting that my knowledge was just dated.
No, I was just wrong.
Don't know why I was so convinced of this.
> Regarding docstrings you can access the underlying function via the __wrapped__ attribute,
This assumes one knows about that. A lot of people never even heard of partial(), and won't know about _ _wrapped_ _. Not to mention I never seen a tool using help() fetching _ _wrapped_ _._ _doc_ _ if it exists.
> and signature forwarding is too brittle and magical for stdlib.
@functools.wraps() does signature forwarding to great success, and is in the stdlib.
Nevertheless, I don't think it would be the right strategy for partial(), because you don't have the exact same signature. But at least having something like:
This function is the result of x() being wrapped with partial(x, 1, foo='bar').
Here is the original docstring of x():
....
unknown|5 years ago
[deleted]
BiteCode_dev|5 years ago
I tried to prove you wrong and run multiple tests that all shown you were right. Then I tried to run them on different python versions, down to Python 2.7, expecting that my knowledge was just dated.
No, I was just wrong.
Don't know why I was so convinced of this.
> Regarding docstrings you can access the underlying function via the __wrapped__ attribute,
This assumes one knows about that. A lot of people never even heard of partial(), and won't know about _ _wrapped_ _. Not to mention I never seen a tool using help() fetching _ _wrapped_ _._ _doc_ _ if it exists.
> and signature forwarding is too brittle and magical for stdlib.
@functools.wraps() does signature forwarding to great success, and is in the stdlib.
Nevertheless, I don't think it would be the right strategy for partial(), because you don't have the exact same signature. But at least having something like: