This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author CliffM
Recipients CliffM, mark.dickinson, tim.peters
Date 2013-10-13.10:40:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1381660813.26.0.420329020982.issue19237@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-10-13 10:40:13CliffMsetrecipients: + CliffM, tim.peters, mark.dickinson
2013-10-13 10:40:13CliffMsetmessageid: <1381660813.26.0.420329020982.issue19237@psf.upfronthosting.co.za>
2013-10-13 10:40:13CliffMlinkissue19237 messages
2013-10-13 10:40:12CliffMcreate