Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 268bf4a

Browse files
committed
Rewrite references to Py3k in __floor__, __ceil__ and __round__ documentation.
1 parent 79edbd5 commit 268bf4a

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

Doc/library/fractions.rst

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Rational number class.
2121
``Fraction`` representing ``numerator/denominator``. If
2222
*denominator* is :const:`0`, raises a :exc:`ZeroDivisionError`. The
2323
second version requires that *other_fraction* is an instance of
24-
:class:`numbers.Fraction` and returns an instance of
25-
:class:`Rational` with the same value. The third version expects a
24+
:class:`numbers.Rational` and returns an instance of
25+
:class:`Fraction` with the same value. The third version expects a
2626
string of the form ``[-+]?[0-9]+(/[0-9]+)?``, optionally surrounded
2727
by spaces.
2828

@@ -40,7 +40,7 @@ Rational number class.
4040
.. method:: from_decimal(dec)
4141

4242
This classmethod constructs a :class:`Fraction` representing the exact
43-
value of *dec*, which must be a :class:`decimal.Decimal`.
43+
value of *dec*, which must be a :class:`decimal.Decimal` instance.
4444

4545

4646
.. method:: limit_denominator(max_denominator=1000000)
@@ -64,24 +64,28 @@ Rational number class.
6464

6565
.. method:: __floor__()
6666

67-
Returns the greatest :class:`int` ``<= self``. Will be accessible through
68-
:func:`math.floor` in Py3k.
67+
Returns the greatest :class:`int` ``<= self``. This method can
68+
also be accessed through the :func:`math.floor` function:
69+
70+
>>> from math import floor
71+
>>> floor(Fraction(355, 113))
72+
3
6973

7074

7175
.. method:: __ceil__()
7276

73-
Returns the least :class:`int` ``>= self``. Will be accessible through
74-
:func:`math.ceil` in Py3k.
77+
Returns the least :class:`int` ``>= self``. This method can
78+
also be accessed through the :func:`math.ceil` function.
7579

7680

7781
.. method:: __round__()
7882
__round__(ndigits)
7983

80-
The first version returns the nearest :class:`int` to ``self``, rounding
81-
half to even. The second version rounds ``self`` to the nearest multiple
82-
of ``Fraction(1, 10**ndigits)`` (logically, if ``ndigits`` is negative),
83-
again rounding half toward even. Will be accessible through :func:`round`
84-
in Py3k.
84+
The first version returns the nearest :class:`int` to ``self``,
85+
rounding half to even. The second version rounds ``self`` to the
86+
nearest multiple of ``Fraction(1, 10**ndigits)`` (logically, if
87+
``ndigits`` is negative), again rounding half toward even. This
88+
method can also be accessed through the :func:`round` function.
8589

8690

8791
.. seealso::

0 commit comments

Comments
 (0)