(__lt__, __gt__, __eq__, __le__, __ge__)
. If a class is given which defines one or more comparison methods, @total_ordering automatically supplies the rest as per the given definitions. However, the class must define one of __lt__(), __le__(), __gt__(),
or __ge__()
and __eq__()
method.Output :
6 > 2 : False
3 < 1 : True
2 = 10 : True
5 == 5 : True
Comments