David Layton added the comment:
Eric,
checked that the file exists
But then you’d run into race conditions. The only sure was to say if a
file can be opened is to open it.
I think you misunderstand me. I am NOT suggesting that you open and
close the file. I am saying that you should not
New submission from David Layton :
argparse.FileType.__call__ opens the specified file and returns it. This is
well documented as an anit-idiom in
http://docs.python.org/howto/doanddont.html#exceptions.
"...a serious problem — due to implementation details in CPython, the file
would n