map
map(func, *iterables) –> map object
seq1 = [1, 2, 3, 4]
seq2 = [5, 6, 7, 8]
m1 = map(lambda x: x ** 2, seq1)
print(list(m1))
# [1, 4, 9, 16]
m2 = map(lambda x, y: x + y, seq1, seq2)
print(list(m2))
# [6, 8, 10, 12]
reduce
reduce(function, sequence[, initial]) -> value
from functools import reduce
seq = [1, 2, 3, 4, 5]
r1 = reduce(lambda x, y: x + y, seq) # (((1+2)+3)+4)+5
# 12
r2 = reduce(lambda x, y: x + y, seq, 10) # ((((10+1)+2)+3)+4)+5
# 25
filter
filter(function or None, iterable) –> filter object
list(filter(None, [1, 1, 0]))
# [1, 1]
list(filter(lambda x: x > 3, [0, 1, 3, 5, 7]))
# [5, 7]
注:map object和filter object都是iterable