Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
__init__ is a normal constructor, __call__ is a call to an object as a function. Initially, you need to understand that everything in python is an object, including functions, so functions also have a __call__ method. This fact is very easy to verify:
>>> def name():
... pass
...
>>> dir(name)
['__call__', ...
>>> class Name(object):
... def __call__(self, first, second):
... return first + second
...
>>> f = Name()
>>> f(1,2)
3
>>>
stackoverflow.com/questions/9663562/what-is-diff...
docs.python.org/2/reference/datamodel.html#object....
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question