CliffM added the comment:

I've handled a patch, and extended both lcm and gcd to take an arbitrary number 
of arguments -- via functools.reduce, as they are both multiplicative (in the 
first argument).

Also handled the zero case , so lcm(0,0) = 0 = gcd(0,0)

Use-case-wise, I do a reasonable amount of number-theoretic work and lcm and 
gcd are always popping up.  If gcd is defined, it's nice to find lcm too.  

For those less well versed in number-theory, the implementation of lcm is not 
so obvious, and many end up going down a tedious prime factorisation route -- 
if they get that far.

But is it all worth it in the fractions module ?  They should really be in the 
math module.

----------
Added file: http://bugs.python.org/file32084/lcm2.patch

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

Reply via email to