标签:cas case val sleep 实体 port ble time 函数
__author__ = ‘Brook Zhao‘
import time
def login(cus_type):
def runfunc(func):
def kenner(*args,**kwargs):
variable01=time.time();
print("Customer Type:%s"%cus_type) #对传入的用户类型进行处理
result=func(*args,**kwargs) #被装饰函数实体运行
variable02=time.time();
return result #返回被装饰函数的返回值
return kenner #返回函数地址
return runfunc #返回函数地址
@login("qq")
def test001(a,b,c):
print("in the test001 case")
time.sleep(1)
return (a+b+c)/3
@login("weixin")
def test002():
print("in the test002 case,the case no return value")
time.sleep(1)
result=test001(1,2,3)
print(result)
test002()
#****************************
Customer Type:qq
in the test001 case
2.0
Customer Type:weixin
in the test002 case,the case no return value
标签:cas case val sleep 实体 port ble time 函数
原文地址:https://www.cnblogs.com/HappyBing/p/9777457.html