Message330135
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 :) |
|
Date |
User |
Action |
Args |
2018-11-20 16:25:27 | mwilbz | set | recipients:
+ mwilbz, vstinner, carljm, methane, serhiy.storchaka, levkivskyi, sir-sigurd |
2018-11-20 16:25:27 | mwilbz | set | messageid: <1542731127.74.0.788709270274.issue34995@psf.upfronthosting.co.za> |
2018-11-20 16:25:27 | mwilbz | link | issue34995 messages |
2018-11-20 16:25:27 | mwilbz | create | |
|