以下是我不理解的代码:
def coroutine(func):
def start(*args,**kwargs):
cr = func(*args, **kwargs)
#cr.next()
next(cr)
return cr
return start
@coroutine #<<<----- HERE
def detectChange(value):
old_value = value
while True:
new_value = (yield)
if new_value != old_value:
print ("Ouch!")
old_value = new_value
@coroutine在语法方面意味着什么?
答案 0 :(得分:1)
答案 1 :(得分:0)
答案 2 :(得分:0)