Dunder methods in Python not only helps in operator overloading, but it gives the power to instantiate a class however we want (talking about __new__
method).
In my opinion, most important βDunderβ or βMagicβ methods that everyone should consider while building a class are:
β __new__
β __repr__
β __getattr__
and __setattr__
β __iter__
and __next__
β __enter__
and __exit__
What are some of your most commonly used dunder methods that you consider while designing a class ?
Just starting you Open Source Journey ? Don't forget to check out Hello Open Source
Want to ++
your GitHub Profile README ? Check out Quote - README
Want to make a simple and awesome game from scratch ? Check out PongPong
Till next time !
Namaste π
Β