class TwoDShape(Thing): def __init__(self): super(TwoDShape, self).__init__() self.perimeter = Disp(u='units') self.area = Area() def __str__(self): s = self.ul_label() s += '{:>9} = {}\n'.format('Area', self.area_) s += '{:>9} = {}'.format('Perimeter', self.perimeter.to_scalar()) return s @property def area_(self): return self.area @area_.setter def area_(self, fl): self.area = Area(fl) @property def perim(self): return self.perimeter @perim.setter def perim(self, fl): self.perimeter = Disp(fl)
def perim(self, fl): self.perimeter = Disp(fl)
def __init__(self): super(TwoDShape, self).__init__() self.perimeter = Disp(u='units') self.area = Area()