Plus the return value
Time Import
DEF Timmer (FUNC): FUNC = Test #
DEF warpper ():
START_TIME the time.time = ()
RES = FUNC () is running # Test ()
stop_time the time.time = ()
Print ( 'run time% S '% (stop_time-START_TIME))
return RES
return warpper
@timmer Timmer # = test (test)
DEF test ():
the time.sleep (. 3)
Print (' function test finishes running ')
return' this is a test of the return value '
RES = Test () # is running warpper
Print (RES)
plus the parameter
Time Import
DEF Timmer (FUNC): FUNC = # test1
DEF warpper (* args, ** kwargs): #test ( 'linhaifeng', Age = 18 is) args = ( 'linhaifeng') = {kwargs 'Age':} 18 is
= the time.time START_TIME ()
RES = FUNC (* args, ** kwargs) # is running Test () FUNC (* ( 'linhaifeng'), {** 'Age': 18 is})
stop_time the time.time = ( )
Print ( 'run time was S%'% (stop_time-START_TIME))
return RES
return warpper
# Test # = @timmer Timmer (Test)
DEF Test (name, Age):
the time.sleep (. 3)
Print ( 'Test function finished running, the name is [% s] age [% s] '% (name, Age))
return' this is a test the return value of '
@timmer
DEF test1 (name, Age, Gender):
the time.sleep (1)
print ( 'test1 function is finished running, the name [% s] age [% s] sex [% s]'% (name, Age, Gender))
return 'This is a test the return value'
# RES = test ( ' linhaifeng ', age = 18) # is running warpper
# # Print (RES)
# test1 (' Alex ', 18 is,' MALE ')
test1 (' Alex ', 18 is,' MALE ')
# DEF test2 (name, Age , Gender): # test2 (* ( 'Alex', 18 is, 'MALE', 'X', 'Y'), ** {})
# # name, Age, Gender = ( 'Alex', 18 is, 'MALE ',' X ',' Y ')
# Print (name)
# Print (Age)
# Print (Gender)
#
# DEF test1 (* args, ** kwargs):
# test2 (* args, ** kwargs) #args = ( 'Alex', 18 is, 'MALE', 'X', 'Y') kwargs} = {
#
# # test2 ( 'Alex', 18 is, Gender = 'MALE')
#
# test1('alex',18,'male')