Jeroen Demeyer <jeroen.k.deme...@gmail.com> added the comment:

> 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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37884>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to