+ 1
Can somebody explain for me more about r magic methods?(e.g __radd__ like in __add__)
In the Python course these magic methods aren't explained well, this made a big(? ) in my mind.
6 Respostas
+ 2
Such a method is called when an object is passed as right operand.
+ 2
Yes, it is. If __add__ of the left operand is not found then __radd__ of the right one is used instead.
+ 2
Thank you so much 🙂 Ilya Vouk.
+ 1
Do you mean r is for right?
0
You're welcome👌
0
These answer's make no sense to me. Can anyone give an example between a normal __add__ and __radd__?