#一、装饰器的作用就是给已经实现的功能再扩展新的功能
#二、无参数的
1 # def wohaoshuai1(func):
2 # print("wohaoshuai1")
3 # return func
4 #
5 # @wohaoshuai1
6 # def wohaoshuai2():
7 # print("wohaoshuai2")
8 #
9 # # 与上面装饰内容原理相同
10 # # wohaoshuai2 = wohaoshuai1(wohaoshuai2)
11 # wohaoshuai2()
#三、有参数
1 # def wohaoshuai1(function):
2 # def inner(*args,**kwargs):
3 # print("wohaoshuai1")
4 # return function(*args,**kwargs)
5 # print(inner)
6 # return inner
7 #
8 # @wohaoshuai1
9 # def wohaoshuai2(name,wohaoshuai,c):
10 # print("wohaoshuai2 {0} {1} {2}".format(name,wohaoshuai,c))
11 # return 1
12 #
13 # print(wohaoshuai2)
14 # a = wohaoshuai2("aaa","bbb",c=1)
15 # print(a)
16 #
17 # <function wohaoshuai1.<locals>.inner at 0x05536108>
18 # <function wohaoshuai1.<locals>.inner at 0x05536108>
19 # wohaoshuai1
20 # wohaoshuai2 aaa bbb 1
21 # 1