when should I explicitely close a file?

Chris Rebert clp2 at rebertia.com
Tue Apr 13 21:19:59 EDT 2010


On Tue, Apr 13, 2010 at 5:45 PM, Giampaolo Rodola' <gnewsg at gmail.com> wrote:
> What about open('foo', 'w').close().
> Does it have the same problems?

Well, no, but that's only because it's a pointless no-op that doesn't
really do anything besides possibly throwing an exception (e.g. if the
script didn't have write access to the current directory).

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list