装饰器测试
def ppp(a):
def foo(c, d):
a(c, d)
print a, c, d
return foo
@ppp
def test(c, d):
print '难舍难分'
test('弟弟', '哥哥') # 这里调用才会执行, 且 装饰器上的 a -> func c,d对应参数
def ppp1(a, b):
def wrapper(c):
print a
print b
print c
return wrapper
@ppp1('fix', 'debug') # 不用调用也会执行, 'fix', 'debug' 对应装饰器 a, b test1作为对象 被c接收到
def test1(d, e):
print '我从来不说谎'