def func():
print('Hello World')
# 1、 The function name refers to the memory address of the function , Function name +() You can execute the function once .
print(func) # <function func at 0x000001E9FB2BF160>
# 2、 The function name is the variable
f1 = func
f2 = f1
f1() # Hello World
f2() # Hello World
# 3、 The function name can be used as an element of the container class data type
def func1():
print(1)
def func2():
print(2)
def func3():
print(3)
l = [func1, func2, func3]
for i in l:
i()
# 4、 The function name can be used as an argument to the function
def func4():
print(6666)
def func5(f):
f()
func5(func4) # 6666
# 5、 The function name can be used as the return value of the function
def func6():
print(6666)
def func7(f):
print(7777)
return f
ret = func7(func6) # 7777
ret() # 6666