title: How does python close files that have been gc'ed?
body: <p>I had always assumed that a file would leak if it was opened without being closed, but I just verified that if I enter the following lines of code, the file will close:</p>
  
  <pre><code>&gt;&gt;&gt; f = open('somefile.txt')
  &gt;&gt;&gt; del f
  </code></pre>
  
  <p>Just out of sheer curiosity, how does this work?  I notice that file doesn't include a <code>__</code>del<code>__</code> method.</p>