Nested calls to Functions:
In the process of calling a function, another function is Called.
defprint(' frombar') defPrint ('fromfoo') bar () foo ()
Nested Definitions of Functions:
In the interior of a function, another function is Defined.
A name defined inside a function that can only be used internally and cannot be used externally
def F1 (): = 1 def F2 (): print('fromf2') Print (x) # Print Value Print (f2) # Print memory address f2 () F1 ( )
Name Space:
Where the name is stored, exactly where the name and the value of the variable are bound
Also can be divided into: built-in namespaces, global namespaces, local namespaces
Built-in Namespaces:
Generated when the Python interpreter starts, storing some python built-in names, len (), if
Global Namespaces:
Generated when executing a file, holding the name of a file-level definition
X=1
def func ():
Pass
Import OS
Class Foo:
Pass
If x==1:z=3
Local Namespaces:
Python Nested call, namespace