Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment: Wouldn't be better to add the function as_integer_ration() in the math module (or in more appropriate place)?
def as_integer_ration(x): if hasattr(x, 'as_integer_ration'): return x.as_integer_ration() else: return (x.numerator, x.denominator) The advantage over adding the int method is that it will automatically support other rational numbers like NumPy integers. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33073> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com