title: Explicitly closing files in python
body: <p>Looking at Learning Python the Hard Way.  Example 17 opens a file, copies it, and then closes it. One of the study drills is to simplify the program down as much as possible. However when I simplified it, there doesn't seem to be any file to close. What I'm trying to understand with the one liner is what, if anything, needs to be closed.</p>
  
  <p>For example-</p>
  
  <pre><code>in_file = open(from_file)
  indata = in_file.read()
  ...
  in_file.close()
  </code></pre>
  
  <p>This can be simplified to</p>
  
  <pre><code>indata = open(from_file).read()
  </code></pre>
  
  <p>I understand it's good practice to close the file after opening it, but both indata and from_file are strings. From some more digging, I understand this is unpythonic and should be done in 2 lines for readability, which would result in a file descriptor. However there is no open file descriptor here to close.  Did I miss something? Should I have a file descriptor to explicitly close?</p>