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 Dennis Sweeney
Recipients Ananthakrishnan, Dennis Sweeney, SilentGhost, mark.dickinson, rhettinger, serhiy.storchaka, steven.daprano, tim.peters
Date 2020-02-16.20:26:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Correction correction: returning zero preserves the invariant below.

from math import gcd as GCD
from functools import reduce
from itertools import starmap, chain

def gcd(*args):
    return reduce(GCD, args, 0)

iterables = [[10, 20, 30],
             [0, 0, 0],
             [-15, -10000000]]

a = gcd(*chain.from_iterable(iterables))
b = gcd(*starmap(gcd, iterables))
assert a == b == 5
Date User Action Args
2020-02-16 20:26:50Dennis Sweeneysetrecipients: + Dennis Sweeney, tim.peters, rhettinger, mark.dickinson, steven.daprano, SilentGhost, serhiy.storchaka, Ananthakrishnan
2020-02-16 20:26:50Dennis Sweeneysetmessageid: <>
2020-02-16 20:26:50Dennis Sweeneylinkissue39648 messages
2020-02-16 20:26:50Dennis Sweeneycreate