Message377820
You might be misunderstanding what @total_ordering does. It can't be used by subclasses to override abstract methods.
>>> from abc import abstractmethod, ABC
>>> from functools import total_ordering
>>> class X(ABC):
@abstractmethod
def __lt__(self, other):
raise RuntimeError('abstract called')
>>> @total_ordering
class Y(X):
def __le__(self, other):
return True
>>> sorted(vars(Y)) # note that __lt__ is missing and Y() won't instantiate
['__abstractmethods__', '__doc__', '__ge__', '__gt__', '__le__', '__module__', '_abc_impl'] |
|
Date |
User |
Action |
Args |
2020-10-02 16:27:58 | rhettinger | set | recipients:
+ rhettinger, gvanrossum, eric.smith, python-dev, avrahami.ben |
2020-10-02 16:27:58 | rhettinger | set | messageid: <1601656078.88.0.536344543869.issue41905@roundup.psfhosted.org> |
2020-10-02 16:27:58 | rhettinger | link | issue41905 messages |
2020-10-02 16:27:58 | rhettinger | create | |
|