Message350330
> FWIW, the entire point of us having recently added as_integer_ratio() methods to so many concrete classes is to avoid the need for helper functions in favor of a simple try/except around a single call.
But what about PEP 3141? The fractions.Fraction constructor accepts numbers.Rational instances, which do not necessarily have an as_integer_ratio() method. We can't just drop support for that (*). So in practice you do need to check both as_integer_ratio() and the PEP 3141 numerator/denominator properties. It seems useful to have a helper function for this.
(*) Unless you want to deprecate PEP 3141. This may be less crazy than it sounds, especially given Guido van Rossum's reaction on https://discuss.python.org/t/pep-3141-ratio-instead-of-numerator-denominator/2037/25?u=jdemeyer |
|
Date |
User |
Action |
Args |
2019-08-23 19:53:59 | jdemeyer | set | recipients:
+ jdemeyer, rhettinger, mark.dickinson, steven.daprano, serhiy.storchaka |
2019-08-23 19:53:59 | jdemeyer | set | messageid: <1566590039.02.0.471164394746.issue37884@roundup.psfhosted.org> |
2019-08-23 19:53:59 | jdemeyer | link | issue37884 messages |
2019-08-23 19:53:58 | jdemeyer | create | |
|