为什么要这么复杂?用简单方法就实现的log搞得花里胡哨
def log(f,x):
print 'call function:'+f.__name__+'()'
return f(x)
def factorial(n):
return reduce(lambda x,y: x*y, range(1, n+1))
f=log(factorial,10)
print f
def log(f,x):
print 'call function:'+f.__name__+'()'
return f(x)
def factorial(n):
return reduce(lambda x,y: x*y, range(1, n+1))
f=log(factorial,10)
print f
2019-01-15
举报