functools.reduce allows you to apply a function cumulatively to the items of an iterable.
functools.reduce
The code above combines functools.reduce and operator.add to get the cumulative sum of a list.
operator.add
My previous tips on functools.