class mystr(int):
def __add__(self,other): # +
return super().__add__(other).__add__(1).__add__(80)
def __sub__(self,other): # -
return super().__sub__(other)
def __mul__(self,other): # *
return super().__mul__(other)
def __truediv__(self, other): # /
return super().__truediv__(other)
a = mystr(20)
b = mystr(10)
print(a+b) # 111 a+b+1+80
print(a-b) # 10
print(a*b) # 200
print(a/b) # 2.0
网友评论