diff options
author | Alex Waygood <Alex.Waygood@Gmail.com> | 2022-05-19 15:28:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-19 15:28:51 (GMT) |
commit | 090df844ea16af3a5df79aba2b9c89ac6a31ba06 (patch) | |
tree | 94842695348fedd190e67d24a86b9140a6debe59 /Doc/library/fractions.rst | |
parent | 639b62c9c479e38a6f91a80b261097574a1e7ac7 (diff) | |
download | cpython-090df844ea16af3a5df79aba2b9c89ac6a31ba06.zip cpython-090df844ea16af3a5df79aba2b9c89ac6a31ba06.tar.gz cpython-090df844ea16af3a5df79aba2b9c89ac6a31ba06.tar.bz2 |
gh-92417: `fractions`, `decimal`: Improve docs for alternative constructor methods (GH-92421)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Diffstat (limited to 'Doc/library/fractions.rst')
-rw-r--r-- | Doc/library/fractions.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst index c893f2d..5f0ecf1 100644 --- a/Doc/library/fractions.rst +++ b/Doc/library/fractions.rst @@ -114,10 +114,10 @@ another rational number, or from a string. .. versionadded:: 3.8 - .. method:: from_float(flt) + .. classmethod:: from_float(flt) - This class method constructs a :class:`Fraction` representing the exact - value of *flt*, which must be a :class:`float`. Beware that + Alternative constructor which only accepts instances of + :class:`float` or :class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is not the same value as ``Fraction(3, 10)``. .. note:: @@ -126,10 +126,10 @@ another rational number, or from a string. :class:`Fraction` instance directly from a :class:`float`. - .. method:: from_decimal(dec) + .. classmethod:: from_decimal(dec) - This class method constructs a :class:`Fraction` representing the exact - value of *dec*, which must be a :class:`decimal.Decimal` instance. + Alternative constructor which only accepts instances of + :class:`decimal.Decimal` or :class:`numbers.Integral`. .. note:: |