运算符重载

class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def __lt__(self, other):
        return \
            self.x < other.x and \
            self.y < other.y

    def __gt__(self, other):
        return \
            self.x > other.x and \
            self.y > other.y


p1 = Point(12)
p2 = Point(23)

b1 = p1 > p2
# b1 is False
b2 = p1 < p2
# b2 is True

print(b1)
print(b2)