| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
This moves abc check for numbers.Rational - down.
|
There is a slight behaviour change here: for Fraction subclasses the construction now goes via .as_integer_ratio, instead of via .numerator and .denumerator (for this reason the benchmark Fraction(Fraction(1, 2)) is improving). A minimal example: import fractions
class MyFraction(Fraction):
@property
def numerator(self):
print('he!')
return super().numerator
f = MyFraction(1,2)
Fraction(f)
I think the change is acceptable and would probably accept the PR. |
Sorry, something went wrong.
>>> help(fractions.Fraction.as_integer_ratio)
Help on function as_integer_ratio in module fractions:
as_integer_ratio(self)
Return a pair of integers, whose ratio is equal to the original Fraction.
The ratio is in lowest terms and has a positive denominator. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. 👍
Sorry, something went wrong.
…pythonGH-134320) This moves abc check for numbers.Rational - down.
…pythonGH-134320) This moves abc check for numbers.Rational - down.
| Back | FazBrowse Home | New Git URL |
This moves abc check for numbers.Rational - down.