函数式编程,使代码简洁高效。
函数编程语言最重要的基础是λ演算(lambda calculus),函数可以像数值一样被赋值于变量,还可以作为其他函数的输入(引数)和输出(传出值)进行传递。
函数可以当做参数来进行传递,形成所谓的高阶函数,形如 z=g(f(x),y),还能像变量一样被创建和修改。
Map函数:
map(func, *iterables),作用是将一个列表映射到另一个列表。
class map(object): """ map(func, *iterables) --> map object Make an iterator that computes the function using arguments from each of the iterables. Stops when the shortest iterable is exhausted. """