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

Good points all, that I will try to address one by one:

Firstly, this function is by no means mandatory for "post-creation mixins". 
Such tools can still be used without calling it (and remain ABC unaware), with 
absolutely no change in functionality. Indeed, the function itself can be used 
as a decorator for just such cases, where a tool is ABC unaware (either from 
deciding that ABC aren't a use case for them, or from simply not considering 
that possibility), but the user wants to also subclass an ABC. The problem is 
that, right now, post-creation tools simply can't be ABC aware.

The thought that few tools are ABC aware is not, I think, a good reason to 
neglect tools that would like to be. Just as dispatch and type-routing tools 
might not be ABC aware to use `abc.get_cache_token()`, but it is still added 
for tools that want to be ABC aware and sidestep this confusing behavior.

As for not occurring in practice: a simple github search reveals many instances 
of comparison operators being abstract, and while likely few of them likely use 
dataclasses, that is a possibility that I believe should be addressed (of 
course, we could decide that this is desired behavior, and scrap this whole 
issue).

Finally, total_ordering: I originally added it to the issue because it was the 
other decorator mixin in the standard library, after I rand into this behavior 
using dataclasses. If total_ordering proves to be a barrier, we can remove it 
from the PR (and perhaps re-introduce it later if that is deemed necessary). I 
will only remark that I find total_ordering used in many hand-rolled classes 
where users would sacrifice some performance for cleaner code and an assertion 
that total order is enforced.

Sorry for the scroll and thanks for the scrutiny :-)

----------

_______________________________________
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