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

Add is_integer to fractions.Fraction #100488

Closed
hauntsaninja opened this issue Dec 24, 2022 · 0 comments
Closed

Add is_integer to fractions.Fraction #100488

hauntsaninja opened this issue Dec 24, 2022 · 0 comments
Labels
type-feature A feature request or enhancement

Comments

@hauntsaninja
Copy link
Contributor

hauntsaninja commented Dec 24, 2022

Requested by @mdickinson in #100268 (comment)

The case for:

  • Improves duck type compatibility between Fraction and float (and now int)
  • Simple to implement; hopefully low maintenance cost

The case against:

  • Not aware of much demand for it from users
  • The case for int.is_integer is much stronger, since the PEP 484 type system conflates float and int | float

Linked PRs

@hauntsaninja hauntsaninja added the type-feature A feature request or enhancement label Dec 24, 2022
hauntsaninja added a commit to hauntsaninja/cpython that referenced this issue Dec 24, 2022
scoder added a commit to scoder/quicktions that referenced this issue Mar 19, 2023
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Mar 21, 2023
https://build.opensuse.org/request/show/1073017
by user dgarcia + dimstar_suse
- Enable python 3.11 build again, now is supported
- Update to 1.14
  - Implement __format__ for Fraction, following python/cpython#100161
  - Implement Fraction.is_integer(), following python/cpython#100488
  - Fraction.limit_denominator() is faster, following
    python/cpython#93730
  - Internal creation of result Fractions is about 10% faster if the
    calculated numerator/denominator pair is already normalised,
    following python/cpython#101780
  - Built using Cython 3.0.0b1.
- 1.13
  - Parsing very long numbers from a fraction string was very slow,
    even slower than fractions.Fraction. The parser is now faster in
    all cases (and still much faster for shorter numbers).
  - Fraction did not implement __int__.
    https://bugs.python.org/issue44547
- 1.12
  - Faster and more spa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant