title: yield in list comprehensions and generator expressions
body: <p>The following behaviour seems rather counterintuitive to me (Python 3.4):</p>
  
  <pre><code>&gt;&gt;&gt; [(yield i) for i in range(3)]
  &lt;generator object &lt;listcomp&gt; at 0x0245C148&gt;
  &gt;&gt;&gt; list([(yield i) for i in range(3)])
  [0, 1, 2]
  &gt;&gt;&gt; list((yield i) for i in range(3))
  [0, None, 1, None, 2, None]
  </code></pre>
  
  <p>The intermediate values of the last line are actually not always <code>None</code>, they are whatever we <code>send</code> into the generator, equivalent (I guess) to the following generator:</p>
  
  <pre><code>def f():
     for i in range(3):
        yield (yield i)
  </code></pre>
  
  <p>It strikes me as funny that those three lines work at all. The <a href="https://docs.python.org/3/reference/expressions.html#yield-expressions">Reference</a> says that <code>yield</code> is only allowed in a function definition (though I may be reading it wrong and/or it may simply have been copied from the older version). The first two lines produce a <code>SyntaxError</code> in Python 2.7, but the third line doesn't.</p>
  
  <p>Also, it seems odd</p>
  
  <ul>
  <li>that a list comprehension returns a generator and not a list</li>
  <li>and that the generator expression converted to a list and the corresponding list comprehension contain different values.</li>
  </ul>
  
  <p>Could someone provide more information?</p>