Decimals -> Fraction strings, my solution

François Pinard pinard at iro.umontreal.ca
Mon May 22 13:36:27 EDT 2000


ullrich at math.okstate.edu (David C. Ullrich) writes:

> def gcd(a, b):
>     while a:
>         a, b = b % a, a
>     return b

By the way, I think the above could be better written:

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

It does not change much, and I'm not even sure exactly why, but I find it
more legible.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard






More information about the Python-list mailing list