练习《PYTHON核心编程(第二版)》中一个有关函数装饰器的例子(例11.2),可是报类型错误,Type Error:'NoneType' object is not callable。一直查不出原因,请高手指点一下。所用Python是3.5.2版本。程序代码如下:
Type Error:'NoneType' object is not callable
错误提示:
欢迎选择我的课程,让我们一起见证您的进步~~
Paste the source code text and then reply.
I have found the mistake. When defining the decorator function tsfunc, the return value should be the wrapped function object, not the wrapped function call. Should be written as "return wrappedFunc", not "return wrappedFunc()"
Paste the source code text and then reply.
I have found the mistake. When defining the decorator function tsfunc, the return value should be the wrapped function object, not the wrapped function call. Should be written as "return wrappedFunc", not "return wrappedFunc()"