class Point(object): def __init__(self, x=0.0, y=0.0): self.x = x self.y = y def __str__(self): return "(%g,%g)" % (self.x, self.y) def __add__(self, other): return Point(self.x + other.x, self.y + other.y) if __name__ == "__main__": print "(10,5) is at %s" % Point(10, 5) print "(10,2)+(2,20) is %s" % (Point(10,2) + Point(2,20))