以'@'开头的Python行?
问题描述:
这里是代码我不明白:
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意味着语法明智?
http://www.dabeaz.com/coroutines/你可以看看这里 – Almo 2012-03-08 18:49:25
您还应该张贴实际的代码。此代码具有无效的缩进。使用复制/粘贴。 – 2012-03-08 18:52:48