0
what does it mean
However, if x hasn't implemented __add__, and x and y are of different types, then y.__radd__(x) is called. #what does it mean, do we need to follow a kind of order while coding?
1 ответ
+ 3
Think about points on a graph.
The whole way a point is set up looks like a tuple with two values (x and y).
If we were to make a Point class, then it would be instansiated with an x and y value, for example Point(3, 6).
Problem is, you cant really add tuples together. So you can "overload" how the Point class reacts to a plus sign or multiplication sign or whatever with magic methods.