STINNER Victor added the comment:

Why patching fraction.Fraction constructor instead of fractions.gcd()?

I don't like the idea of having two functions, math.gcd and fractions.gcd, 
which do almost the same, but one is slow, whereas the other is fast. It's 
harder to write efficient code working on Python < 3.5 (use fractions) and 
Python >= 3.5 (use math or fractions?).

I suggest to modify fractions.gcd() to use math.gcd() if the two parameters are 
int. We just have to adjust the sign: if the second parameter is negative, 
return -math.gcd(a, b). (I guess that we have unit tests for fractions.gcd 
checking the 4 cases for signed parameters.)

----------
nosy: +haypo

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

Reply via email to