Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Object-Oriented Python Advanced Objects Math

Euenlee Tan
Euenlee Tan
2,165 Points

Why do we have to learn all these magic methods?

I do understand the usage of dunder init, as you tell the system what inputs to expect. But why do we have to know add, or str or radd or iadd?

1 Answer

Steven Parker
Steven Parker
231,198 Points

Depending on the purpose of your class, you might not need all (or any) of those methods, but they will be important if you want to create objects that can be printed or that you can perform math on.