Ben Chuanlong Du's Blog

It is never too late to learn.

Dunder/Magic Methods in Python

__call__ (Object Invocation)

We can make any object callable like a regular function by adding the call dunder method. Let’s consider the below toy(not very meaningful) example just to showcase the call method.

In [ ]:

In [ ]:

In [ ]:

In [ ]:

In [ ]:

Comments