+ 9

(SOLVED) Python magic "r..." methods

What is the purpose of "r" magic methods, like __radd__? SoloLearn didn't explained that well.

8th Jul 2021, 12:09 PM
đŸ‡ș🇩 GUMBALL đŸ‡ș🇩 [Dead account]
2 Respostas
+ 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
8th Jul 2021, 12:35 PM
Angelo
Angelo - avatar
+ 7
Angelo Thank you for answer! 😊
8th Jul 2021, 1:04 PM
đŸ‡ș🇩 GUMBALL đŸ‡ș🇩 [Dead account]