__call__ Intercepts Calls : Call : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Call »

 

__call__ Intercepts Calls


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)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Class
» Call