#coding=utf-8
from functools import wraps
def test1(func):
@wraps(func)
def wrap(*args,**kwargs):
print "#"*20
return func(*args,**kwargs)
return wrap
@test1
def one():
return "hello"
a = one()
print a
# one = test1(one)=wrap
# 相当于:
# one()=wrap()
# print "#"*20
# func()=one()=return "hello"
# 函数返回没有接收
# 不能作为结果随wrap一起返回
参考: