title: iterator that reads values from file
body: <p>Is it possible to read values from a file with an iterator, so that the file is automatically closed at the end of the iteration?</p>
  
  <p>Creating such an iterator using the <code>with</code> statement doesn't seem to work.</p>
  
  <pre><code>with open('/dev/zero', 'rb') as f:                                              
      values = iter(f.read(1) for i in (1, 2, 3))                                 
  
  values.next()             #ValueError: I/O operation on closed file                                        
  </code></pre>