def test1(): print('in the test1') def test(): print('in the test') return test1 print(test) res = test() print(res()) in the test in the test1 None
def foo(): name = 'majun' def bar(): name = 'mmj' def tt(): print(name) return tt return bar bar = foo() tt = bar() print(tt) tt() foo()()() <function foo.<locals>.bar.<locals>.tt at 0x0000019B87157C80> mmj mmj