Message 330135 - Python tracker (original) (raw)
Inada-san, I think it's fair to ask for a broader vision about how ABCs are used. In that respect I'm wondering about some inconsistencies in the existing functools module about whether wrappers should maintain the wrapped function's isabstractmethod attribute.
Both singledispatchmethod and partialmethod implement their own way of copying isabstractmethod from the wrapped function. singledispatchmethod does this in addition to calling update_wrapper, whereas partialmethod doesn't seem to use update_wrapper at all.
In terms of a broader vision, then, should the decorators in functools be more consistent about whether the isabstractmethod attribute of a wrapped function is preserved in the wrapped version? Should update_wrapper be the way to standardize this? If so, it would make sense either to remove the isabstractmethod copying from those decorators, or otherwise to add isabstractmethod to the list of attributes that are copied from the wrapped function by update_wrapper.
Hopefully viewing the problem in this way avoids the pitfalls of adding random code to the codebase, as you are pointing out. Let me know if this discussion belongs in a broader issue than this one. Thank you :)