def first (f):p rint f.__name__, ' Call First () ' Def fn_1 ():p rint f.__name__, ' Call First () _ Fn_1 () ' Return F () return fn_1def s Econd (f):p rint f.__name__, ' call second () ' Def fn_2 ():p rint f.__name__, ' call second () _fn_2 () ' Return F () return Fn_2def Test ():p rint ' test ' test= First (second (test)) test ()
def first (f):p rint f.__name__, ' Call First () ' Def fn_1 ():p rint f.__name__, ' Call First () _ Fn_1 () ' Return F () return fn_1def s Econd (f):p rint f.__name__, ' call second () ' Def fn_2 ():p rint f.__name__, ' call second () _fn_2 () ' Return F () return fn_2@ First@seconddef test ():p rint ' Test ' test ()
The first is the interpretation of the second kind.
Run results
Why would fn_2 call first_fn_1 () and Test call second_fn_2 () run?
The fn_2 and test at this time are the names of the variable F passed in first and second, respectively.
Python Double Decorator Preliminary understanding