The function definition below comes from the itertools recipes page (https://docs.python.org/2/library/itertools.html#recipes).
def random_product(*args, **kwds): "Random selection from itertools.product(*args, **kwds)" pools = map(tuple, args) * kwds.get('repeat', 1) return tuple(random.choice(pool) for pool in pools)
The function signature would seem to be more readable written with the "repeat" argument specified explicitly, e.g.
def random_product(*args, repeat=1)
But I'm guessing there is a reason why it is written using the general idiom. Can anyone explain?