Given a condition at the time a class is instantiated, I want to change how __call__ is used. From the example below, self.no is using self.yes but self.__call__ is not. Can someone please explain why?
EXAMPLE: class YesNo(object): def __init__(self, which): self.no = self.yes self.__call__ = self.yes def yes(self, val): print 'Yes', val def no(self, val): print 'No', val def __call__(self, val): raise NotImplementedError() >>> y = YesNo(True) >>> y.yes('hello') Yes hello >>> y.no('hello') Yes hello >>> y('hello') Traceback .... Not ImplementedError -- http://mail.python.org/mailman/listinfo/python-list