Code review comment for lp:~cjwatson/launchpad/refactor-cron-germinate

Revision history for this message
Colin Watson (cjwatson) wrote :

On Wed, Dec 07, 2011 at 10:14:27AM -0000, Jeroen T. Vermeulen wrote:
> +def file_contents(path):
> + """Return the contents of the file at path."""
> + with open(path) as handle:
> + return handle.read()
>
> Since you're only reading the file, there's probably no hurry to close this file handle. So you could just return “open(path).read().”

For the record, there was some discussion on this on IRC, and most
people seemed to think that it was better to retain the immediate close,
in particular since implementations other than cPython may not GC-close
it with any alacrity; so I've left this the way it is. (There is a lot
of variation on this in the Launchpad test suite, though ...)

« Back to merge proposal