[Python-ideas] Add create mode to open()

Benjamin Peterson benjamin at python.org
Tue Aug 16 23:26:23 CEST 2011

David Townshend <aquavitae69 at ...> writes:

> This idea was proposed in the discussion on shutil.move, but I thought it
would be worth posting separately to avoid confusing the discussion.
> The idea is to add a create mode ('c') to the builtin open() function, which
will have the same effect as os.open(file, os.O_EXCL|os.O_CREAT).  I have added
an issue (http://bugs.python.org/issue12760) for this, including a patch.

I am -1 because

- Possibly not portable or at least subject to implementations of
varying quality.
- No precedence in other languages or fopen() for that matter.
- It's not hard to use os.fdopen().

More information about the Python-ideas mailing list