def __eq__(self, other):
    return type(self) is type(other
        ) and self.x == other.x and self.y == other.y

def __ne__(self, other):
    return not self.__eq__(other)

def __hash__(self):
    return hash((self.x, self.y))
Установить вычитание в Python