On Oct 23, 2016 9:12 AM, "Danilo J. S. Bellini" <email@example.com> wrote:
Actually, itertools.accumulate and functools.reduce have their parameters reversed, and accumulate doesn't have a "start" parameter.
def accumulate2(fn=operator.add, it, start=None):
if start is not None:
it = iterations.chain([start], it)
return itertools.accumulate(it, fn)
I would have preferred this signature to start with, but it's easy to wrap.