diff -r 18882c93f4bd Lib/numbers.py --- a/Lib/numbers.py Mon Apr 27 13:53:54 2015 +0300 +++ b/Lib/numbers.py Mon Apr 27 14:49:45 2015 +0200 @@ -281,14 +281,18 @@ # Concrete implementation of Real's conversion to float. def __float__(self): - """float(self) = self.numerator / self.denominator + """float(self) = float(self.numerator / self.denominator) - It's important that this conversion use the integer's "true" - division rather than casting one side to float before dividing - so that ratios of huge integers convert without overflowing. + It's important that this conversion use "true" division of the + numerator and denominator rather than casting one side to float + before dividing so that ratios of huge integers convert without + overflowing. + If the result of the division is another Rational instance, care + should be taken to avoid infinite recursion, e.g., by overriding + __float__ in the returned type. """ - return self.numerator / self.denominator + return float(self.numerator / self.denominator) class Integral(Rational):