def __hash__(self):
    return hash(self._d)

def __add__(self, other):
    return type(self)(self.x + other.x, self.y + other.y)

def __mul__(self, scalar):
    return type(self)(self.x * scalar, self.y * scalar)

def __repr__(self):
    return '%s(%s, %s)' % (type(self).__name__, self.x, self.y)

def __abs__(self):
    return math.hypot(self.x, self.y)
Использование кортежей Python в качестве векторов