Message309307
> 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. |
|
Date |
User |
Action |
Args |
2017-12-31 20:44:08 | mark.dickinson | set | recipients:
+ mark.dickinson, rhettinger, gphemsley |
2017-12-31 20:44:08 | mark.dickinson | set | messageid: <1514753048.12.0.467229070634.issue32466@psf.upfronthosting.co.za> |
2017-12-31 20:44:08 | mark.dickinson | link | issue32466 messages |
2017-12-31 20:44:07 | mark.dickinson | create | |
|