__call__ Intercepts Calls : call « Class « Python Tutorial






class Prod:
    def __init__(self, value):
        self.value = value
    def __call__(self, other):
        return self.value * other

x = Prod(2)
print x(3)
print x(4)








11.15.call
11.15.1.__call__ Intercepts Calls