Message313877
Adding as_integer_ratio() to numbers.Rational is a breaking change. It breaks the interface. Currently all numbers.Rational subclasses implement all public methods and properties of the abstract class, but with adding as_integer_ratio() this will be no longer true.
>>> issubclass(numpy.int64, numbers.Rational)
True
>>> numpy.int64.as_integer_ratio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'numpy.int64' has no attribute 'as_integer_ratio'
I suggest to make as_integer_ratio() creating an implicit interface (as write() creates an implicit interface for writable file-like objects), and add a convenient function (in the numbers or the math module) which calls this method if it exists and falls back to the (nominator, denominator) pair otherwise. |
|
Date |
User |
Action |
Args |
2018-03-15 11:51:29 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, gvanrossum, tim.peters, rhettinger, mark.dickinson, Nofar Schnider |
2018-03-15 11:51:28 | serhiy.storchaka | set | messageid: <1521114688.98.0.467229070634.issue33073@psf.upfronthosting.co.za> |
2018-03-15 11:51:28 | serhiy.storchaka | link | issue33073 messages |
2018-03-15 11:51:28 | serhiy.storchaka | create | |
|