练习《PYTHON核心编程(第二版)》中一个有关函数装饰器的例子(例11.2),可是报类型错误,Type Error:'NoneType' object is not callable
。一直查不出原因,请高手指点一下。所用Python是3.5.2版本。
程序代码如下:
错误提示:
伊谢尔伦2017-04-18 10:21:09
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()"