__call__() python

class Foo:
    def __call__(self, a, b, c):
        # ...

x = Foo()
x(1, 2, 3) # __call__

Here is what the above code is Doing:
1. We create a class Foo.
2. We define a __call__ method on Foo.
3. We create an instance of Foo, x.
4. We call x as a function, passing in 1, 2, and 3 as arguments.
5. Python sees that x is a callable, so it calls x.__call__(1, 2, 3).

The __call__ method is just like any other method, except for the fact that it gets called when you call the object as a function.