Guido van Rossum <gu...@python.org> added the comment:

Ah, okay. I wasn't familiar with @total_ordering so I assumed differently.  
Sorry for the continued misunderstanding.

Perhaps we should just leave it alone completely then, since ISTM that any 
change to its implementation may cause subtle bugs in currently working code.

The problem you see only occurs when there are abstract ordering methods 
present. The cure is simple, just implement all four comparison functions (and 
do away with @total_ordering). This is not a great burden. Instead we should 
probably add a line or two to the docs explaining how it interacts with ABCs 
defining abstract ordering methods.

@dataclass uses a different approach ("is it defined in the current class?"). 
That is perfectly ready for a call to abc.update_abstractmethods(). (I checked, 
and dataclasses already depends on abc, indirectly via functools, so the extra 
import is free.)

----------

_______________________________________
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