''' Created on 2019年11月2日 @author: Administrator ''' import time def timefun(func): def wrappedfunc(): print("start the method : %s"%(func.__name__)) start = time.time() rst = func() end = time.time() print("end the method : %s"%(func.__name__)) print("total cost time :", str((end-start))) return rst return wrappedfunc @timefun def foo(): time.sleep(1) print("I am foo") @timefun def getInfo(): return '----hahah---' f = foo() print(type(f))