Is it mandatory to invoke dunder function? Is there any default implementation of these function?
Dunder function doubt
Dunder methods are nothing but simple functions . They are declared same we declare normally. But just the difference they are such functions which are defined by the default for classes , such as __init__
, __add__
, __repr__
, etc.
They define some default functioning of class objects.
They are invoked themselves whenever they are called by the interpreter you dont need to specifically invoke them.
Dunder functions are already present in pythons source code , even when you dont make them in your function they are automatically called whenever they are needed.
Eg- whenever you add two numbers using + __add__
is automatically invoked
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.