
python – 覆盖二维向量类中的__mul__以保持传播性
我已经定义了以下类: class Point(object): def __repr__(self): return (+str(self.x)+,+str(self.y)+) def __init__(self, x, y): self.x = x self.y = y def __add__(self,
我已经定义了以下类: class Point(object): def __repr__(self): return (+str(self.x)+,+str(self.y)+) def __init__(self, x, y): self.x = x self.y = y def __add__(self,