What are Python magic or dunder methods?

Junior Python

Answer

Special methods like __init__, __str__, __repr__, __eq__, __add__.
Used for operator overloading and customizing built-in behavior.
Example: obj1 + obj2 calls obj1.__add__(obj2).

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice