randomState = collections.namedtuple('randomState', ['player', 'score'])
Let's say I have a namedtuple that contains player/score and if I were to replace any of those functions, I would do:
def random(state):
return state._replace(score='123')
How do I create a class that has a function that basically resembles a namedtuple, and is able to replace either player/score manually?
class Random:
def abc(self, score):
if self.score == '123':
###had it were a namedtuple, I would use the replace function here, but classes don't allow me to do that so how would I replace 'score' manually?
I'm not sure if I'm making sense here, but if anyone understands my problem I'd much appreciate your feedback. Thanks