Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-100488: Add is_integer method to fractions.Fraction #100489

Merged
merged 3 commits into from
Jan 1, 2023

Conversation

hauntsaninja
Copy link
Contributor

@hauntsaninja hauntsaninja commented Dec 24, 2022

@hauntsaninja
Copy link
Contributor Author

The documentation guarantees that denominator is in lowest term. It doesn't make any explicit guarantee about being positive, but as_integer_ratio does and just returns the denominator. But do let me know if I should change to abs(self._denominator) == 1 or self._numerator % self._denominator == 0!

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(But let's wait for Mark to also give feedback.)

Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; one reST markup nitpick.

Doc/library/fractions.rst Outdated Show resolved Hide resolved
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
@hauntsaninja hauntsaninja merged commit e83f88a into python:main Jan 1, 2023
@hauntsaninja hauntsaninja deleted the fraction-is-integer branch January 1, 2023 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants