title: Send values to Python coroutine without handling StopIteration
body: <p>Given a Python coroutine:</p>
  
  <pre><code>def coroutine():
       score = 0
       for _ in range(3):
            score = yield score + 1
  </code></pre>
  
  <p>I'd like to use it in a simple loop like this:</p>
  
  <pre><code>cs = coroutine()
  for c in cs:
       print(c)
       cs.send(c + 1)
  </code></pre>
  
  <p>... which I would expect to print</p>
  
  <pre><code>1
  3
  5
  </code></pre>
  
  <p>But actually, I get an exception on the line <code>yield score + 1</code>:</p>
  
  <pre><code> TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
  </code></pre>
  
  <p>I can get it to work if I call <code>next</code> manually:</p>
  
  <pre><code>c = next(cs)
  while True:
      print(c)
      try:
          c = cs.send(c + 1)
      except StopIteration:
          break
  </code></pre>
  
  <p>But I don't like that I need to use try/except, given that generators are usually so elegant.</p>
  
  <p>So, is there any way to use a finite coroutine like this without explicitly handling <code>StopIteration</code>? I'm happy to change both the generator and the way I'm iterating over it.</p>
  
  <h2>Second Attempt</h2>
  
  <p>Martijn points out that both the <code>for</code> loop and my call to <code>send</code> advance the iterator. Fair enough. Why, then, can't I get around that with two yield statements in the coroutine's loop?</p>
  
  <pre><code>def coroutine():
      score = 0
      for _ in range(3):
          yield score
          score = yield score + 1
  
  cs = coroutine()
  for c in cs:
      print(c)
      cs.send(c + 1)
  </code></pre>
  
  <p>If I try that, I get the same error but on the <code>send</code> line.</p>
  
  <pre><code>0
  None
  Traceback (most recent call last):
    File "../coroutine_test.py", line 10, in &lt;module&gt;
      cs.send(c + 1)
  TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
  </code></pre>