Is a with on open always necessary?
roy at panix.com
Fri Jan 20 19:22:19 EST 2012
In article <mailman.4883.1327074990.27778.python-list at python.org>,
Arnaud Delobelle <arnodel at gmail.com> wrote:
> > So maybe doing a
> > with open(filename) as f:
> > Â Â contents = f.readlines()
> That's what I do, unless I'm in an interactive session.
>From the resource management point of view, there's no doubt that's the
right thing to be doing. That being said, I don't bother most of the
time and I can't think of a time when I've been bitten by it.
More information about the Python-list