list(itertools.accumulate([1, 2, 3, 4], lambda x, y: x + y))
list(itertools.accumulate([1, 2, 3, 4], lambda x, y: x + y + 1))
reducelist in Python: like reduce but giving the list of intermediate results