1 2 3 4 5 6 7 8 9
class Vec: def __init__(self,x,y): self.x=x self.y=y def __init__(self,other): return Vec(self.x+other.x,self.y+other.y) v1=vec(1,2) v2=vec(3,4) print v1+v2