[Liao Xuefeng] book notes

Iterator iterator

Python is an encapsulation function is built-in support, we have a function by a large segment split the code, the function call by layer by layer, the complex task can be broken down into simple tasks, such decomposition can be called for procedure design. Function is the basic unit of process-oriented programming.

Higher-order functions
passed to the function
higher-order function
Map ()
Map (F, [X1, X2, X3, X4]) = [F (X1), F (X2), F (X3), F (X4)]
the reduce ( )
the reduce (F, [X1, X2, X3, X4]) = F (F (F (X1, X2), X3), X4)
filter () function is used to filter sequences from a selected qualified sequence element.
sorted () sorting algorithm
returns a function
closure
called internal function when the function returns a function that has become closure only when the call does not return a value (be careful not to return with variables function)
anonymous function
lambda x: x * x
decorator
partial function creates a fixed function of a built-in function, simplify the operation of call

Module
in Python, a .py file is called a module (Module)
using the module function and variable names to avoid conflicts,
the package
method according to the organization directory module, becoming the package Package
contains __init__.py under each package file, which is itself a module, the module name is the package his name.

Function is a target

Guess you like

Origin www.cnblogs.com/wangwana/p/11577655.html