1#this will allow you to treat object as function
2class Test:
3 def __init__(self, num):
4 self.num = num
5 def __call__(self, inp):
6 print(self.num*inp)
7
8#create an instance of Test class
9obj = Test(5)
10obj(3) #15
11
1class Foo:
2 def __call__(self, a, b, c):
3 # ...
4
5x = Foo()
6x(1, 2, 3) # __call__