[Tutor] Scope and elegance
Tiger12506
keridee at jayco.net
Tue Jan 8 00:40:12 CET 2008
I like this.
class Counter:
def __init__(self):
self.score = 0
def incr(x, y):
self.score += 2*x+3*y
class Board:
def __init__(self):
self.counter = Counter()
self.curcoords = (0,0)
def update(self)
self.counter.incr(*self.curcoords)
Whatever OOP term is used to describe that. In other words, make your board
class be a container for the various counters. Especially if certain Boards
always contain certain counters. Just personal opinion...
More information about the Tutor
mailing list