diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2024-10-14 07:54:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-14 07:54:59 (GMT) |
commit | b52c7306ea4470f9d7548655c2a1b89a07ff5504 (patch) | |
tree | 9a2bf501c6107a4a25e5fceaa8102cbd013bc96a /Misc/NEWS.d | |
parent | 66b3922b97388c328c9bd8df050eef11c0261fae (diff) | |
download | cpython-b52c7306ea4470f9d7548655c2a1b89a07ff5504.zip cpython-b52c7306ea4470f9d7548655c2a1b89a07ff5504.tar.gz cpython-b52c7306ea4470f9d7548655c2a1b89a07ff5504.tar.bz2 |
gh-121797: Add class method Fraction.from_number() (GH-121800)
It is an alternative constructor which only accepts a single numeric argument.
Unlike to Fraction.from_float() and Fraction.from_decimal() it accepts any
real numbers supported by the standard constructor (int, float, Decimal,
Rational numbers, objects with as_integer_ratio()).
Unlike to the standard constructor, it does not accept strings.
Diffstat (limited to 'Misc/NEWS.d')
-rw-r--r-- | Misc/NEWS.d/next/Library/2024-07-15-19-34-56.gh-issue-121797.qDqj59.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2024-07-15-19-34-56.gh-issue-121797.qDqj59.rst b/Misc/NEWS.d/next/Library/2024-07-15-19-34-56.gh-issue-121797.qDqj59.rst new file mode 100644 index 0000000..9525379 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-07-15-19-34-56.gh-issue-121797.qDqj59.rst @@ -0,0 +1,2 @@ +Add alternative :class:`~fractions.Fraction` constructor +:meth:`Fraction.from_number() <fractions.Fraction.from_number>`. |