python
def outer(a, b):
def inner():
return a + b
return inner#Returns an object instead of calling the inner function
f = outer(1,3)
print(f)
print(f())
Execution result
<function outer.<locals>.inner at 0x7**c3dfa*****>
4
in print (f) The information of the inner object is returned, a + b is not running.
If you do f (), inner will be executed.
Recommended Posts