class Vector(object):

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

def __str__(self):
    return '(%s,%s)' % (self.x, self.y)

def __add__(self, n):
    if isinstance(n, (int, float)):
        return Vector(self.x + n, self.y + n)
Changing the order of operation for __add__, __mul__, etc. methods in a custom class