Does a File Object Automatically Close when its Reference Count Hits Zero?
<p>I was under the impression that file objects are immediately closed when their reference counts hit 0, hence the line:</p>

<pre><code>foo = open('foo').read()
</code></pre>

<p>would get you the file's contents and immediately close the file. However, after reading the answer to <a href="http://stackoverflow.com/questions/1832528/is-close-necessary-when-using-iterator-on-a-python-file-object">http://stackoverflow.com/questions/1832528/is-close-necessary-when-using-iterator-on-a-python-file-object</a> I get the impression that this does not happen, and that calling <code>.close()</code> on a file object is <em>always</em> necessary.</p>

<p>Does the line above do what I think it's doing and even if it does, is it the Pythonic thing to do?</p>
