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/decimal.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/decimal.rst')
-rw-r--r-- | Doc/library/decimal.rst | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index 2ad84f2..d052581 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -571,9 +571,10 @@ Decimal objects >>> Decimal(321).exp() Decimal('2.561702493119680037517373933E+139') - .. method:: from_float(f) + .. classmethod:: from_float(f) - Classmethod that converts a float to a decimal number, exactly. + Alternative constructor that only accepts instances of :class:`float` or + :class:`int`. Note `Decimal.from_float(0.1)` is not the same as `Decimal('0.1')`. Since 0.1 is not exactly representable in binary floating point, the |