Can __radd__ work with the operands in any order?
问题 I want my Fraction class to work as a float when it's being added to floats or integers so I can naturally perform operations with it, but it's only working when the Fraction is the rightmost operand. Is there a way to make it work with the operands in any order or should I override another method that I haven't learned of? Code (I guess variable names are pretty self-explanatory): def __radd__(self,target): if type(target) == int or type(target) == float: return target + self.num/self.den 1