Rename rational.Rational to fractions.Fraction, to avoid name clash
with numbers.Rational. See issue #1682 for related discussion.
diff --git a/Doc/library/numbers.rst b/Doc/library/numbers.rst
index 6ee8f27..7a5f105 100644
--- a/Doc/library/numbers.rst
+++ b/Doc/library/numbers.rst
@@ -106,7 +106,7 @@
Implementors should be careful to make equal numbers equal and hash
them to the same values. This may be subtle if there are two different
-extensions of the real numbers. For example, :class:`rational.Rational`
+extensions of the real numbers. For example, :class:`fractions.Fraction`
implements :func:`hash` as follows::
def __hash__(self):
@@ -201,11 +201,11 @@
Because most of the operations on any given type will be very similar,
it can be useful to define a helper function which generates the
forward and reverse instances of any given operator. For example,
-:class:`rational.Rational` uses::
+:class:`fractions.Fraction` uses::
def _operator_fallbacks(monomorphic_operator, fallback_operator):
def forward(a, b):
- if isinstance(b, (int, long, Rational)):
+ if isinstance(b, (int, long, Fraction)):
return monomorphic_operator(a, b)
elif isinstance(b, float):
return fallback_operator(float(a), b)
@@ -217,7 +217,7 @@
forward.__doc__ = monomorphic_operator.__doc__
def reverse(b, a):
- if isinstance(a, RationalAbc):
+ if isinstance(a, Rational):
# Includes ints.
return monomorphic_operator(a, b)
elif isinstance(a, numbers.Real):
@@ -233,7 +233,7 @@
def _add(a, b):
"""a + b"""
- return Rational(a.numerator * b.denominator +
+ return Fraction(a.numerator * b.denominator +
b.numerator * a.denominator,
a.denominator * b.denominator)