title: Modifying yield from's return value
body: <p>Let's say I have these parsers:</p>
  
  <pre><code>parsers = {
      ".foo": parse_foo,
      ".bar", parse_bar
  }
  </code></pre>
  
  <p><code>parse_foo</code> and <code>parse_bar</code> are both generators that yield rows one by one. If I wish to create a single dispatch function, I would do this:</p>
  
  <pre><code>def parse(ext):
      yield from parsers[ext]()
  </code></pre>
  
  <p>The yield from syntax allows me to tunnel information easily up and down the generators.</p>
  
  <p>Is there any way to maintain the tunneling while modifying the yield results?<br>
  Doing so while breaking the tunneling is easy:</p>
  
  <pre><code>def parse(ext):
      for result in parsers[ext]():
          # Add the extension to the result
          result.ext = ext
          yield result
  </code></pre>
  
  <p>But this way I can't use <code>.send()</code> or <code>.throw()</code> all the way to the parser.</p>
  
  <p>The only way I'm thinking of is by doing something ugly like <code>try: ... except Exception: ...</code> and pass the exceptions up, while doing the same for <code>.send()</code>. It's ugly, messy and bug-prone.</p>