1.访问的两种形式
A
>>> def funOUT():
def funIN():
print('in now')
return funIN()
>>> funOUT()
in now
B
>>> def funOUT():
def funIN():
print('in now')
return funIN
>>> funOUT()()
in now
2.
- def funX():
- x = 5
- def funY():
- nonlocal x
- x += 1
- return x
- return funY
- a = funX()
- print(a())
- print(a())
- print(a())
6
7
8