from functools import reduce
print(reduce(lambda x, y: x + y, range(10)))
print(sum(range(10)))
Used when a black listed builtin function is used.
Usual black listed functions are the ones like map
, or filter
,
where Python offers now some cleaner alternative like list comprehension.