I began learning functional programming recently, and came up with this example when attempting to calculate my quiz average for a class.
The example I came up with
In place of sum? Never.
But a reduce call would be the way to go when aggregating by a custom method.
For instance product could be defined as:
product
product = lambda iterable: reduce(operator.mul, iterable)
Also sum is implemented in C.
sum