Matt Wilber <mattwilbe...@gmail.com> added the comment:

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 :)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34995>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to