#def定义的非匿名函数,不会被立即回收
'''
def foo():
print("in the foo")
bar() #foo调用的时候,还未被被定义,所以报错
foo()
'''
def bar():
print("in the bar")
def foo():
print("in the foo")
bar() #已经被定义,所以不报错
foo()
#匿名函数,内存立即回收
calc = lambda x:x*3
calc(3) #等于9
转载于:https://www.cnblogs.com/wzsx/p/9077226.html