def outer_function(): # this is the outer most function
print("I am outer")
def inner_func(): # inner function
print("I am inner")
def inner_inner_func(): # inside the inner function
print("I m inner inner")
def inner_inner_func_2(): #inside the child of inner child
print("I a inner inner 2")
return inner_inner_func_2
return inner_inner_func
return inner_func
a = outer_function()
CodePudding user response:
inner functions don't return anything at all;
because of it, you don't need to use the return command.
you can just call them with this code:
inner_func_2()
but if your code is something else and bigger that returns something; please edit and fix your question.
CodePudding user response:
There is an formatting mistake in the question, the outer_function
was not included.
def outer_function():
def inner_func(): # inner function
print("I am inner")
def inner_inner_func(): # inside the inner fucntion
print("I m inner inner")
def inner_inner_func_2(): #inside the child of inner child
print("I a inner inner 2")
return inner_inner_func_2
return inner_inner_func
return inner_func
outer_function()()()()