装饰器实际运行轨迹
def f7(x1):
    print('加的又一个新功能d')
    def f8():
        print('加的又一个新功能7')

        x1()

        print('加的又一个新功能8')

    return f8


def f5(x2):
    print('加的又一个新功能c')
    def f6():
        print('加的又一个新功能5')

        x2()

        print('加的又一个新功能6')
    return f6



def f3(x3):
    print('加的又一个新功能b')
    def f4():
        print('加的又一个新功能3')

        x3()

        print('加的又一个新功能4')
    return f4



def f1(x4):
    print('加的又一个新功能a')
    def f2():
        print('加的又一个新功能1')

        x4()

        print('加的又一个新功能2')
    return f2
@f7
@f5
@f3
@f1
def fx():
    print('调用fx')

fx()


结果为:


加的又一个新功能a
加的又一个新功能b
加的又一个新功能c
加的又一个新功能d
加的又一个新功能7
加的又一个新功能5
加的又一个新功能3
加的又一个新功能1
调用fx
加的又一个新功能2
加的又一个新功能4
加的又一个新功能6
加的又一个新功能8


解释
fx() - ->f1(fx()) - ->f3(f1(fx())) - ->f3(f1(fx())) - ->f5(f3(f1(fx()))) - ->f7(f5(f3(f1(fx()))))

f7(f5(f3(f1(fx())))) - ->f8
x1=f5(f3(f1(fx())))
f7(x1) - ->f8
f8
x1() - ->f5(f3(f1(fx())))()
f5(f3(f1(fx()))) - ->f6
x2=f3(f1(fx()))
f5(x1) - ->f6
f6
x2() - ->f3(f1(fx()))()
f3(f1(fx())) - ->f4
x3=f1(fx())
f3(x3) - ->f4
f4
x3() - ->f1(fx())()
f1(fx()) - ->f2
x4=fx()
f1(x4) - ->fx()
fx()
倒回去执行丢掉的那一句语句
加的又一个新功能2 - -> 加的又一个新功能4 - ->加的又一个新功能6 - ->加的又一个新功能8