标签:
import time
def hh(func):
def wrapper(*args, **kwargs):
start=time.clock()
func(*args, **kwargs)
end=time.clock()
print ‘time:%f‘%(end - start)
return wrapper
def out_log(func):
def wrapper(*args, **kwargs):
print ‘stsart %s‘%func
func(*args, **kwargs)
print ‘end %s‘%func
return wrapper
def a(a,b):
print a + b
def times(a,b):
print a * b
@hh
@out_log
def say(a):
print ‘hello‘
#say=hh(say)
#say=out_log(say(‘a‘))
say(‘test‘)
#say()
#say()
标签:
原文地址:http://www.cnblogs.com/yjz1/p/5367873.html