python装饰器笔记
def param(dict):
def decorater1(func):
def make_decorater(x):
print('现在开始装饰')
x = x + 'vvv'
func(x)
print('现在结束装饰')
return dict['a']
return make_decorater
return decorater1
def decorater2(func):
def make_decorater(x):
print('现在开始再套装饰2')
func(x)
print('现在结束再套装饰2')
return make_decorater
return decorater2
dict = {'a':'23432'}
@param(dict)
@decorater2
def func(x):
print('被装饰的函数'+x)
print(func('aaa'))