Ben Avrahami <avrahami....@gmail.com> added the comment:

> Adding a function to recalculate will require everyone to use it

I'd argue that this is akin to `functools.update_wrapper`. It too is a function 
that must be called in virtually every function decorator (the only function 
decorators that don't/needn't call it are the built-in method decorators and, 
appropriately enough, @abstractmethod), and if not called, certain 
functionality won't work.

> and worse, know that it even exists

I think that knowing about such a function is a fair requirement. Mixin tools 
already has nuances and edge cases, such that it should only be done (and 
especially distributed) by advanced users.

Furthermore, not all class mixin tools have/need to be ABC-aware. Just as 
`total_ordering` is ABC-agnostic (indeed, it is also subclass-agnostic), any 
other mixin tool can decide that implementing abstract classes is simply not a 
use case for them. The upshot of the `update_abstractmethods` implementation is 
that, as long as their implementation isn't afraid to override methods that are 
already defined (like attrs does), the function can be slotted above 
ABC-agnostic wrappers and it suddenly becomes ABC-aware.

----------

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

Reply via email to