def outer(a, b):
def inner():
return a + b
return inner# inner関数を呼び出すのではなくオブジェクトを返す
f = outer(1,3)
print(f)
print(f())
実行結果
<function outer.<locals>.inner at 0x7**c3dfa*****>
4
print(f)では
innerオブジェクトの情報が返ってきて、
a + bは実行されていない。
f()とするとinnnerが実行される。