If I do the following, does filehandle get closed automatically as it goes out of scope in Python:
def read_contents(file_path): return file(file_path).rea
It should close the file handle in the file's __del__ statement, but a better approach would be to use a with block:
__del__
with
def read_contents(file_path): with open(file_path, 'r') as f: return f.read()
See http://docs.python.org/library/stdtypes.html#file.close for more information.