Gordon P. Hemsley <gphems...@gphemsley.org> added the comment:

Indeed, that is the code fragment I was referring to.

Mathematically speaking, a rational number is one that can be expressed as a 
fraction of two integers, so in that regard the numerator and the denominator 
should both be integers.

But let's assume for argument's sake that a type comes through where the 
numerator and the denominator are fractions: 1/2 and 2/3, respectively. This 
code would normalize them by cross-multiplying:

numerator = 1 * 3 = 3
denominator = 2 * 3 = 6

Now they are both integers.

In what scenario would the numerator and denominator be numbers.Rational but 
not an integer or a fraction? If someone could even come up with one, would it 
be worthwhile to allow as a fraction?

And on the flip side, if math.gcd() only accepts integers and not, at least, 
numbers.Integral, wouldn't that be a bug?

----------

_______________________________________
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