import timefrom functools import reducedef log(f): def fn(x): print ('call' + f._name_ +'()...') return f(x) return fn@logdef fac(n): return reduce(lambda x,y:x*y,range(1,n+1))print fac(2) Traceback (most recent call last): File "C:\Users\gege\Desktop\aa.py", line 11, in <module> print fac(2) File "C:\Users\gege\Desktop\aa.py", line 5, in fn print ('call' + f._name_ +'()...')AttributeError: 'function' object has no attribute '_name_'>>>
添加回答
举报
0/150
提交
取消