Mark Dickinson <dicki...@gmail.com> added the comment:
The relevant piece of Python code from fractions.py looks like this: if type(numerator) is int is type(denominator): # *very* normal case g = math.gcd(numerator, denominator) if denominator < 0: g = -g else: g = _gcd(numerator, denominator) I wonder whether we should simply drop the type check: math.gcd should accept anything that supports __index__ (and that includes NumPy integer types and anything that implements numbers.Integral). OTOH, math.gcd will return a plain int, and if we have some subclass myint of int, we might want all the arithmetic to stay in the domain of myints (though I'm not really sure _why_ we'd want that). In that case we'll need to restore the pure Python _gcd implementation. ---------- status: closed -> open _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39350> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com