嘿,我是一个初学者,希望得到一些建议。
class Board():
def __init__(self):
self.x = 0
self.y = 0
def SelectSquare(self,direction):
#based on some value from direction
self.x += 1
#or
self.y += 1
#return square at self.x and self.y
考虑到以上代码,像这样在对象内部创建会发生变化的属性是否是不良实践?