Python行以'@'开头?

时间:2012-03-08 18:47:53

标签: python syntax functional-programming

  

可能重复:
  What does @ mean in 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在语法方面意味着什么?

3 个答案:

答案 0 :(得分:1)

答案 1 :(得分:0)

答案 2 :(得分:0)