代码块1:
from time import ctime,sleep
def tsfun(func):
def two():
print ‘[%s] %s() called’ %(ctime(),func.name)
return func()
return two
@tsfun
def foo():
print ‘ok’
pass
foo()
sleep(1)
for i in range(2):
sleep(1)
foo()
代码块2:
from time import ctime,sleep
def tsfun():
def two():
print ‘[%s] called’ %(ctime())
return tsfun
return two()
tsfun()
如何理解1,2中return two(),与return two。到底什么时候该返回什么。求解释