Slide 32
Slide 32 text
In python 3.x, __builtins__.reduce has
been moved to functools.reduce
Several properties of reduce
reduce( lambda a, b: a | b , [True, False, False], False ) # any
reduce does not short-circuit; which would
explain why it is slower than the builtin any or
all for use cases below:
reduce( lambda a, b: a & b , [False, False, True], False ) # all
Homework:
Implement map & filter using reduce.