[Python-ideas] Add create mode to open()
Ben Finney
ben+python at benfinney.id.au
Wed Aug 17 02:58:36 CEST 2011
Guido van Rossum <guido at python.org> writes:
> So what's the use case?
I agree that I don't see the use case that isn't already adequately
covered. You generally get what you explicitly ask for, and that's how
it should be.
A point of correction, though:
> In general when using a command line environment overwriting the file
> is what you *want* to happen. Like with Unix "foo >bar". I don't even
> think there *is* a shell syntax for not overwriting an existing file,
The ‘bash(1)’ man page describes the ‘noclobber’ option:
If the redirection operator is >, and the noclobber option to the
set builtin has been enabled, the redirection will fail if the file
whose name results from the expansion of word exists and is a
regular file.
--
\ “If you go flying back through time and you see somebody else |
`\ flying forward into the future, it's probably best to avoid eye |
_o__) contact.” —Jack Handey |
Ben Finney
More information about the Python-ideas
mailing list