class Vector(tuple):

    def __add__(self, a):
        return Vector(x + y for x, y in zip(self, a))

def __mul__(self, c):
    return Vector(x * c for x in self)

def __rmul__(self, c):
    return Vector(c * x for x in self)
a = Vector((1, 2, 3))
b = Vector((2, 3, 4))
print(a + b)
print(3 * a)
print(a * 3)
Использование кортежей Python в качестве векторов