"Python study manual" September 23

def is an executable statement before running python def, the function does not exist. When python def statement to run, it will generate a new function object and assigns it to the function name, and all of the assignment, the function name into a function object.

No return statement, the function returns the default None.

Do not add the import statement .py and paths.

When you use the variable name is not defined in a function, Python finds four scopes and where to locate the first variable stop: local scope, the outer layer or lambda def local scope, global scope, the built-in scope.

When you give a variable in the function name assigned (and not just in a single expression reference it), python will create or change the name of a local variable scope, unless the variable has been declared in the function is global variables.

Guess you like

Origin www.cnblogs.com/zhenguan/p/11571459.html
Recommended