+ 9
(SOLVED) Python magic "r..." methods
What is the purpose of "r" magic methods, like __radd__? SoloLearn didn't explained that well.
2 Respuestas
+ 3
when doing a+b
It tries to do a.__add__(b)
If it is not defined then it tries
b.__radd__(a)
It's called __radd__ becouse it's the object on the right side of the operand to call it
+ 7
Angelo Thank you for answer! 😊