第8.21节 Python中__lt__、__gt__等 “富比较”(“rich comparison”)方法用途探究
一、富比较方法Python的基类object提供一系列可以用于实现同类对象进行“比较”的方法,可以用于同类对象的不同实例进行比较。他们也是实例方法,定义如下:object.lt(self,other)object.le(self,other)object.eq(self,other)object.ne(self,other)object.gt(self,other)object.ge(self,o