@total_ordering
class Grade(enum.Enum):
    A = 5
B = 4
C = 3
D = 2
F = 1

def __lt__(self, other):
    if self.__class__ is other.__class__:
        return self.value < other.value
return NotImplemented
Grade.A >= Grade.B
Grade.A >= 3
How to compare Enums in Python?