title: Coroutines in python
body: <p>I read the following code from a book, and have some questions about it.</p>
  
  <pre><code>def coroutine(func):
      def start(*args, **kwargs):
          g = func(*args, **kwargs)
          g.next()
          return g
      return start
  
  @coroutine
  def receiver():
      print("Ready to receive")
      while True:
          n = (yield)
          print("Got %s" % n)
  
  r = receiver()
  r.send("hello, world")
  </code></pre>
  
  <p>By using <code>coroutine</code>, no initial <code>.next()</code> is needed. My understanding is, if <code>r = receiver()</code>, then <code>r = start</code>, so when I call <code>r.send()</code>, it equals to <code>start.send()</code>, then I call <code>.next()</code> again, right?  But the result is not what I expected.</p>