有人可以解释初始化程序之后函数中发生了什么吗?
具体other.row和other.column。我以前从未见过这种情况,也不明白如何传递变量并使用它来引用实例属性。
class Window:
def __init__(self, row: int, column: int):
self.column = column
self.row = row
def __add__(self, other):
row = self.row + other.row
col = self.column + other.column
return Tile(row, col)