1

I am new to python and trying to create a class named Add that will have a modified call to make its objects act like functions and be callable multiple times like the following: class Adds:

#def __call__(self):
     #code for addition

obj1 = Add(10) ---> should return 10 obj1(12)(10) ----> should return 22 obj1(12)10)(9) --->should return 31

However, whatever I try to do the result will be " object not callable". The point is how do we make an object callable in a way that it accepts more arguments in parenthesis as I mentioned above. ex : object(arg1)(arg2)...

0 Answers0