Class method : Class call : Class PYTHON examples


PYTHON examples » Class » Class call »

 

Class method


Class method: __init__ and __call__


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)

           
       



    Related Scripts with Example Source Code in same category :

Leave a Comment / Note


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


PYTHON examples

 Navioo Class
» Class call