Mark Dickinson <dicki...@gmail.com> added the comment:

> but it would result in a behaviour change: for the above code, we'd get a 
> `Fraction` whose numerator and denominator were both of actual type `int` 
> instead of `mpz`

Ah, sorry. That's not true in this particular case. The returned gcd would be 
of type `int`, but then we end up dividing an `mpz` by an `int` to get an 
`mpz`. So I guess the problem case is where we have something that's like `mpz` 
but that doesn't support division by a plain `int`: I don't think there's any 
requirement that instances of numbers.Integral support mixed-type arithmetic 
with plain ints.

I'd actually be happier if the `fractions.Fraction` type *did* normalise so 
that its numerator and denominator always had exact type `int`, but that's not 
the way that it was designed: it was designed to support arbitrary 
numbers.Integral instances.

----------

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

Reply via email to