python 类支持比较

2019-12-04  本文已影响0人  SkTj

class House:
def eq(self, other):
pass
def lt(self, other):
pass
# Methods created by @total_ordering
le = lambda self, other: self < other or self == other
gt = lambda self, other: not (self < other or self == other)
ge = lambda self, other: not (self < other)
ne = lambda self, other: not self == other

上一篇下一篇

猜你喜欢

热点阅读