From http://bugs.python.org/issue14156
"argparse.FileType for '-' doesn't work for a mode of 'rb'"
I learned that 'stdin/out' can be embedded in an 'open' by using the 'fileno()' and 'closefd=False' (so it isn't closed at the end of open).
With this, the dummy file context that I implemented in the previous patch, could be replaced with:
partial(open, sys.stdin.fileno(), mode=self._mode,..., closefd=False)
However, as Steven Bethard wrote in the earlier issue, setting up tests when stdin/out will be redirected is not a trivial problem. So I don't yet have a testable patch.
---------------
And just for the record, the 'osaccess' testing that I wrote earlier, probably should also test that proposed output file string is not already a directory.