On Oct 23, 2016 9:12 AM, "Danilo J. S. Bellini" <danilo.bell...@gmail.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.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to