[New-bugs-announce] [issue12760] Add create mode to open()
report at bugs.python.org
Tue Aug 16 15:49:19 CEST 2011
New submission from David Townshend <aquavitae69 at gmail.com>:
Currently, opening a file with open(file, 'w') overwrites existing files. It would be useful for open() to raise an error when the file exists. This proposal is to add a 'c' mode to open, which has the effect to creating a file and opening it for writing, but raising an IOError if it already exists (i.e. the same as os.open(file, os.O_EXCL|os.O_CREAT).
The attached patch implements this, including tests and documentation.
assignee: docs at python
components: Documentation, IO, Library (Lib), Tests
nosy: David.Townshend, docs at python
title: Add create mode to open()
type: feature request
versions: Python 3.3
Added file: http://bugs.python.org/file22910/open_create.patch
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce