classPoint(object):def__init__(self,x,y):
self.x = x
self.y = y
def__sub__(self,other):assert isinstance(other,Point)#判断传入的数据是否为Point类return Point(self.x+other.x,self.y+other.y)
@propertydefxy(self):return (self.x,self.y)
def__str__(self):# 显示print(a-b)结果return"x={0},y={1}".format(self.x,self.y)
def__repr__(self):#显示 a-b的解结果return str(self.xy)
# a = Point(50,60)# b = Point(30,40)# a - b