Execution process
650) this.width=650; "style=" height:214px;width:375px; "src=" http://images2015.cnblogs.com/blog/425762/201510/ 425762-20151024114048849-189055880.png "width=" "height=" 938 "alt=" 425762-20151024114048849-189055880.png "/ >
for CPython, It compiles, interprets, and finally runs on CPython virtual machines.
2. Outer variable, can be used by inner layer variable
An inner variable cannot be used by an outer variable-the inner variable is defined as global and can be used globally (and stack?). )
3. Boolean values
True false 1 or 0 empty word spaces list etc are false
4. Use of common variable types
String startswith endswith expandtabs partition replace
List Extend (iterable) insert (index,object) Pop (index)
Dictionary SetDefault (k,d) update ()
Collection Add Difference difference_update intersection intersection_update
Symmetric_difference symmetric_difference_update
Union update
5. Collection
Counter counter an ordered dictionary orderdict the default dictionary defaultdict a named tuple namedtuple
Bidirectional queue Deque
6. Iterator Iterator Generator generator
7. Shallow copy copies only the parent object and does not copy the child objects inside the object
Deep copy copy objects and their sub-objects
8. Built-in functions
VARs () dictionary type
__name__
9. Functions
FUCN (*args,**kwargs)
10. File operation
with open () as X, () as Y: Multiple files can be opened
A. Lambda simple function
Map Reduce Filter
13. Generator Yield xrange
14. The adorner functions as a parameter of a function
def auth (func):
def inner ():
print ' Before '
Func ()
print ' after '
return inner
@auth
Def f1 ():
print ' F1 '
F1 ()
@ Operation 1. The following function name F1 is passed as a parameter into the adorner function Àauth (F1)
2. Execute auth (F1), return to inner, equivalent to F1->inner, when executing F1 () becomes inner ()
If you touch @, you'll do it first.
You can use multiple adorners, which is equivalent to a few more boxes.
@deco1
@deco2
def fun ():
Three-layer Decorator
Review of the first four lessons