标签:lambda 调用 cal 内存 def print int 回收 特点
#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
标签:lambda 调用 cal 内存 def print int 回收 特点
原文地址:https://www.cnblogs.com/wzsx/p/9077226.html