<div dir="rtl"><div dir="ltr">Instead of implementing 4 comparison methods, I suggest using total_ordering:</div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr">>>> from functools import total_ordering</div>
<div dir="ltr">>>> @total_ordering</div><div dir="ltr">... class OrderedEnum(Enum):</div><div dir="ltr">...     def __gt__(self, other):</div><div dir="ltr">...         if self.__class__ is other.__class__:</div>
<div dir="ltr">...             return self.value > other.value</div><div dir="ltr">...         return NotImplemented</div><div dir="ltr">... </div><div><br></div><div>I believe the reader needn't be famiiar with total_ordering() to understand what's going on here.</div>
<div><br></div><div>elazar</div></div></div>