def __init__(self, x, y):
    object.__setattr__(self, _d, (x, y))

def __setattr__(self, n, v):
    raise ValueError("Can't alter instance of %s" % type(self))

@property
def x(self):
    return self._d[0]

@property
def y(self):
    return self._d[1]

def __eq__(self, other):
    return self._d == other._d

def __ne__(self, other):
    return self._d != other._d

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 в качестве векторов