def __getattribute__(self, name): """Intercept all observer notifications for functions named on*() and store the arguments.""" if name.startswith('on'): def onCallback(*args): self.calls[name] = args return BaseGame.__getattribute__(self, name)(*args) return onCallback return BaseGame.__getattribute__(self, name)
def onCallback(*args): self.calls[name] = args return BaseGame.__getattribute__(self, name)(*args)