'''Created on 2013/2/3@author: CYChiang'''importmathclassPoint(object):def__init__(self,x=0,y=0):self.x=xself.y=ydefdistance_from_origin(self):returnmath.hypot(self.x,self.y)def__eq__(self,other):returnself.x==other.xandself.y==other.ydef__repr__(self):return"Point({0.x!r}, {0.y!r})".format(self)def__str__(self):return"({0.x!r}, {0.y!r})".format(self)@propertydefx(self):returnself.__x@propertydefy(self):returnself.__y@x.setterdefx(self,x):assertx>0,"must be nonzero and non-negative"self.__x=x@y.setterdefy(self,y):asserty>0,"must be nonzero and non-negative"self.__y=yclassCircle(Point):radius=0def__init__(self,radius=0,x=0,y=0):#super().__init__(x, y)#super(Circle, self).__init__(x, y)Point.__init__(self,x,y)self.radius=radius@propertydefedge_distance_from_origin(self):returnabs(self.distance_from_origin-self.radius)@propertydefarea(self):returnmath.pi*(self.radius**2)defcircumference(self):return2*math.pi*self.radiusdef__eq__(self,other):returnself.radius==other.radiusandsuper().__eq__(other)def__repr__(self):return"Circle({0.radius!r}, {0.x!r}, {0.y!r})".format(self)def__str__(self):returnrepr(self)@propertydefradius(self):returnself.__radius@radius.setterdefradius(self,radius):assertradius>0,"must be nonzero and non-negative"self.__radius=radius