我在试着理解装饰者的行为。我知道装饰器必须返回一个对象,所以我可以理解下面的语法: print("Deco is called with parameter the functionDeco is called with parameter the function <function salut at 0x00BA5198>
在这里,装饰器并没有做太多的事情,但是如果我需要修改函数通过modified_func
我有一些代码的一个简单的转速计数器的微位。当返回变量rev_per_second时,有时它是一个NoneType (原因未知)。我试图将其捕获到函数中,但似乎不起作用。我哪里搞错了?program
while True:
rev_per_min = revs() # sometimes this is "None