装饰器前奏2(2017年8月23日 11:50:39)(2017年8月29日 16:07:32)
门牌号的作用是让人找到这个房间
门牌号没有的话 就会清空里面的内容(python的内存回收机制)
函数就是变量
匿名函数(没有函数名)
calc = lambda x:x*3 print(calc(3))
函数只要定义了,就能调用。
函数就是一种变量(加引号的变量)
# def foo(): # print('in the foo') # bar() # foo() #只要定义了,就能调用 def bar(): print('in the bar') def foo(): print('in the foo') bar() foo() def foo(): print('in the foo') bar() def bar(): print('in the bar') foo()
# def foo() # print('in the foo') # bar() # foo() # def bar() # print('in the bar')