[issue43133] Accept file mode "rw" to open-or-create a file and seek to the start

2021-02-05 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Open modes "r", "r+", "w", "w+", "a", "a+" are supported by C function fopen() 
and similar functions in other languages. Would not "rw" be confusing? Are 
there fopen-like functions in other programming languages which support this 
mode?

Are there any examples in the stdlib which would benefit from this feature? The 
closest that I found is in mailbox and combines "rb+" with "wb+" and "rb", and 
I seen combinations of "rb+" and "xb+" in third-party code, but they are 
different cases.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43133] Accept file mode "rw" to open-or-create a file and seek to the start

2021-02-04 Thread Nick Coghlan


New submission from Nick Coghlan :

After yet again trying to use "rw" to open a file in read/write mode, having it 
fail, and then having to look up the docs to remind myself that the correct 
spelling is "r+", I'm finally filing this to suggest we make the obvious "rw" 
spelling actually work.

Rather than making it an alias for any of the existing modes, I'd suggest that 
it combine the features of "r+" and "a+":

* like "r+" it would start the file pointer at the beginning of the file
* like "a+" it would create the file if it didn't exist, while leaving existing 
files alone

--
messages: 386510
nosy: ncoghlan
priority: low
severity: normal
status: open
title: Accept file mode "rw" to open-or-create a file and seek to the start
type: enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com