如何指定方法的返回类型与类本身相同?
class Position: def __init__(self, x: int, y: int): self.x = x self.y = y def __add__(self, other: Position) -> Position: return Position(self.x + other.x, self.y + other.y)
__add__Position?
元芳怎么了
慕妹3242003
不负相思意
随时随地看视频慕课网APP
相关分类