Skip to content

bpo-37822: Add math.as_integer_ratio(). #15210

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

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Aug 11, 2019

@jdemeyer
Copy link
Contributor

I think it would be good to define more precisely what are the output types. We require the output of as_integer_ratio to be two integers, but what does "integer" mean in this context? A Python int? An object which implements __index__? An instance of numbers.Integral?

My personal vote would be to require __index__ (I don't mean that we should check that condition, but we should document it).

Copy link
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

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

One small issue I noticed:

math.as_integer_ratio
x: object
/
greatest common divisor of x and y
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a copy-paste error. Maybe:

Suggested change
greatest common divisor of x and y
Return the rational representation of x as the pair (numerator, denominator).

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you. But this proposition was rejected.

@serhiy-storchaka serhiy-storchaka deleted the math-as_integer_ratio branch August 24, 2019 09:44
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.

5 participants