
class Point(object):
    def __init__(self, coord=(0, 0)):
        self.x , self.y = coord
#        print self.x, self.y
        
    def set(self, newCoord):
        self.x , self.y = newCoord
        
    def getCoord(self):
        return(self.x, self.y)

    def __add__(self, p):
        """Add 2 points, return a new point
        or point and two ints"""
        if isinstance(p, Point):
            return Point((self.x + p.x, self.y + p.y))
        else:
            return Point((self.x + p[0], self.y + p[1]))

    def copyXY(self, other):
        "replace self's xy with another's point"
        self.x = other.x
        self.y = other.y

    def moveRel(self, deltas):
        "change current x,y by adding the deltas"
        dx, dy = deltas
        self.x += dx
        self.y += dy

    def moveAbs(self, newCoord):
        self.x, self.y = newCoord

    def __repr__(self):
        "return a string representation of this point."
        return 'Point((%d,%d))' % (self.x, self.y)

if __name__ == '__main__':
    p = Point((5, 6))
    print p
    q = Point((2, 2))
    p.copyXY(q)
    p.moveRel((10, 10))
    print p
    print p + q
    r = Point((25, 10))
    print r + (10, 25)
