Skip to content

bpo-37836: support .as_integer_ratio() in Fraction #15327

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

Closed
wants to merge 4 commits into from

Conversation

jdemeyer
Copy link
Contributor

@jdemeyer jdemeyer commented Aug 18, 2019

When constructing instances of fractions.Fraction, the given numerator
and denominator may now be any objects with an as_integer_ratio() method.

CC @serhiy-storchaka , @rhettinger

https://bugs.python.org/issue37836

When constructing instances of fractions.Fraction, the given numerator
and denominator may now be any objects with an as_integer_ratio() method.
@aeros aeros added the type-feature A feature request or enhancement label Aug 22, 2019
Co-Authored-By: Ashwin Ramaswami <aramaswamis@gmail.com>
@rhettinger
Copy link
Contributor

I believe we're decided that no one needs this and that it may even be hazardous — especially when accepting Fraction(2.5, 4.5) when the entire point of the fractions module is to achieve exactness by working with integer arithmetic.

@rhettinger rhettinger closed this Apr 20, 2022
@serhiy-storchaka
Copy link
Member

I concur with @rhettinger.

I am even think that if Fraction() is called with two arguments, both of them must be integers. But the ship is already sailed, and I am not want to argue about deprecating the current behavior (accepting Rationals).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants