title: Is close() necessary when using iterator on a Python file object
body: <p>Is it bad practice to do the following and <strong>not</strong> explicitly handle a file object and call its <code>close()</code> method?</p>
  
  <pre><code>for line in open('hello.txt'):
      print line
  </code></pre>
  
  <p>NB - this is for versions of Python that do not yet have the <code>with</code> statement.</p>
  
  <p>I ask as the Python documentation seems to recommend this :-</p>
  
  <pre><code>f = open("hello.txt")
  try:
      for line in f:
          print line
  finally:
      f.close()
  </code></pre>
  
  <p>Which seems more verbose than necessary.</p>