Форум сайта python.su
0
class Rmaxplus:
def __init__(self, x):
self.x=x
def __add__(self,other):
return Rmaxplus(max(self.x, other.x))
Офлайн
0
Тут я разобрался, надо было дописать
def __radd__(self,other):
return Rmaxplus(max(self.x, other.x))
def __add__(other, self):
return Rmaxplus(max(self.x, other.x))
def __radd__(other, self):
return Rmaxplus(max(self.x, other.x))
Офлайн