2

What advantage does one get by using Dunder methods when we can write our own methods in python? Why taking built-in functions and modifying them instead of writing our own?

Sai Sankar
  • 21
  • 1

1 Answers1

2

One of the biggest advantages of using Python's dunder methods is that they provide a simple way to make objects behave like built-in types. That means you can avoid ugly, counter-intuitive, and nonstandard ways of performing basic operators. Writing your own methods sometimes may take more time and comparatively it is easy to take built in function and modify them as per your needs.

For more please have a look there Why does Python use 'magic methods'?