title: Why does this code yield a generator?
body: <p>I wrote the following into the Python interpreter today:</p>
  
  <pre><code>&gt;&gt;&gt; def test():
  ...     for c in ['a', 'b', 'c', 'd']: yield c
  ...
  &gt;&gt;&gt; a = test()
  &gt;&gt;&gt; a
  &lt;generator object test at 0x2556a00&gt;
  &gt;&gt;&gt; a.next()
  'a'
  &gt;&gt;&gt; a.next()
  'b'
  </code></pre>
  
  <p>This was surprising to me. Shouldn't <code>test</code> return (or yield) one of the elements in my list, not a generator which yields them?</p>
  
  <p>A second function which uses "return" behaves as expected:</p>
  
  <pre><code>&gt;&gt;&gt; def test2():
  ...     for i in ['a', 'b', 'c', 'd']: return i
  ...
  &gt;&gt;&gt; b = test2()
  &gt;&gt;&gt; b
  'a'
  &gt;&gt;&gt; b
  'a'
  </code></pre>
  
  <p>Why is this so? Where in the documentation describes this behaviour?</p>