The argparse docs don't say who's responsible for closing FileType objects
alister.ware at ntlworld.com
Wed Jan 25 10:33:03 EST 2017
On Wed, 25 Jan 2017 07:16:24 -0800, Bob Kline wrote:
> The subject line pretty much says it all. Should the programmer close
> the file? If the programmer does that, and the user has asked that the
> file object be hooked up to standard in (or standard out) what will
> happen? If the programmer doesn't close it, does it get closed cleanly
> in the face of an exception?
i would think the principle is always the same
if you open a file close it behind you
using "with" should ensure this always happens
It is bad luck to be superstitious.
-- Andrew W. Mathis
More information about the Python-list