第四点,要知道,函数的返回值也可以是函数对象(闭包),比如下面这个例子:
def func_closure():
def get_message(message):
print '11111111111111111111111111111'
print('Got a message: {}'.format(message))
return get_message
send_message = func_closure()
print send_message
print type(send_message)
send_message('hello world')
C:Python27python.exe "C:/Users/TLCB/PycharmProjects/untitled2/python study/fun1.py"
<function get_message at 0x00502570>
<type 'function'>
11111111111111111111111111111
Got a message: hello world