mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +00:00
gh-101825: Clarify that as_integer_ratio() output is always normalized (#101843)
Make docstrings for `as_integer_ratio` consistent across types, and document that the returned pair is always normalized (coprime integers, with positive denominator). --------- Co-authored-by: Owain Davies <116417456+OTheDev@users.noreply.github.com> Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
This commit is contained in:
parent
4f3786b761
commit
4624987b29
7 changed files with 21 additions and 27 deletions
|
@ -331,10 +331,9 @@ class Fraction(numbers.Rational):
|
|||
return self._denominator == 1
|
||||
|
||||
def as_integer_ratio(self):
|
||||
"""Return the integer ratio as a tuple.
|
||||
"""Return a pair of integers, whose ratio is equal to the original Fraction.
|
||||
|
||||
Return a tuple of two integers, whose ratio is equal to the
|
||||
Fraction and with a positive denominator.
|
||||
The ratio is in lowest terms and has a positive denominator.
|
||||
"""
|
||||
return (self._numerator, self._denominator)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue