首页 > 其他 > 详细

函数特点

时间:2018-05-23 15:51:32      阅读:172      评论:0      收藏:0      [点我收藏+]
#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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!