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(Point): def __init__(self, x, y, endpoint): super(Line, self).__init__(x, y) self.endpoint = endpoint def length(self): return self.distanceTo(self.endpoint)