Thor Whalen added the comment:
On the surface, seems like a fair design to me: Back-compatible yet solves
this misalignment that bugged me (literally).
It would also force the documentation of `functools.wraps` to mention this
"trap", through describing the `signature_changed` flag.
New submission from Thor Whalen :
`Mapping.__reversed__` exists, but is not listed in the table:
https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes
https://github.com/python/cpython/blob/master/Doc/library/collections.abc.rst
--
assignee: docs
Thor Whalen added the comment:
Dennis,
Thanks for the (very complete) explanation. I induced to err because of the
following confusing facts:
```
from collections.abc import Mapping, Sequence
import sys
if sys.version_info <= (2, 7):
assert '__reversed__' not in dir(
New submission from Thor Whalen :
# PROBLEM
When using `functools.wraps`, the signature claims one set of defaults, but the
(wrapped) function uses the original (wrappee) defaults.
Why might that be the desirable default?
# PROPOSED SOLUTION
Adding '__defaults__', '__k
Thor Whalen added the comment:
Posted to stackoverflow to gather opinions about the issue:
https://stackoverflow.com/questions/62782230/python-functools-wraps-doesnt-deal-with-defaults-correctly
Also made GitHub PR: https://github.com/python/cpython/pull/21379
--
keywords: +patch
Thor Whalen added the comment:
Further, note that even with the additional '__defaults__', and
'__kwdefaults__', `functools.wraps` breaks when keyword only arguments involved:
```
from functools import wraps, WRAPPER_ASSIGNMENTS, partial
# First, I need to ad
Thor Whalen added the comment:
Hi Terry, sorry for the later reply.
Is this a bugfix? Well, I'm not sure what you would call a bug. Can't one
always redefine a bug to be a feature, and visa versa?
I would definitely say that the behavior (seeing one default in the
signature, but a
Thor Whalen added the comment:
You are the guardians of the great python, so we can leave it at that if
you want. That said for posterity, I'll offer a defense.
The same "the tools does what it does, and if you need something else, use
another tool" argument could have been