Given a class defining one or more rich comparison ordering methods,
this class decorator supplies the rest. This simplifies the effort
involved in specifying all of the possible rich comparison operations:
The class must define one of __ lt__(), __ le__(), __ gt__(), or
__ ge__(). In addition, the class should supply an __ eq__() method.
如果您使用的是Python3.2或更高版本,那么可以使用functools.total_ordering。你知道吗
相关问题 更多 >
编程相关推荐