]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-121797: Add class method Fraction.from_number() (GH-121800)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 14 Oct 2024 07:54:59 +0000 (10:54 +0300)
committerGitHub <noreply@github.com>
Mon, 14 Oct 2024 07:54:59 +0000 (07:54 +0000)
commitb52c7306ea4470f9d7548655c2a1b89a07ff5504
tree9a2bf501c6107a4a25e5fceaa8102cbd013bc96a
parent66b3922b97388c328c9bd8df050eef11c0261fae
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.
Doc/library/fractions.rst
Doc/whatsnew/3.14.rst
Lib/fractions.py
Lib/test/test_fractions.py
Misc/NEWS.d/next/Library/2024-07-15-19-34-56.gh-issue-121797.qDqj59.rst [new file with mode: 0644]