class Point(object): def __init__(self, x, y): self.x = x self.y = y def distanceTo(self, other): return abs(self.x - other.x) + abs(self.y - other.y) class Line(object): def __init__(self, p1, p2): self.p1 = p1 self.p2 = p2 def length(self): return self.p1.distanceTo(self.p2)