2 ms·
I think this is due to poor naming, not due to short functions. Compare: def makeMove(self, target): enemy_piece = target.piece if enemy_piece:
by nine_k 13y ago
I think this is due to poor naming, not due to short functions.
Compare:
def makeMove(self, target):
enemy_piece = target.piece
if enemy_piece:
self.takeEnemyPiece(enemy_piece)
target.piece = self
self.position = target
And
def changeCoords(self, foo):
if foo.standing_on_it:
self.nowItsMine(foo.standing_on_it)
foo.standing_on_it = self
self.coords = foo
In the former case, you mostly don't need to consult the source of functions called. In the latter, you're never sure.