[docs] documentation suggestion
eliben at gmail.com
Wed Jan 26 05:53:13 CET 2011
> In http://docs.python.org/library/functions.html#open
> "Modes 'r+', 'w+' and 'a+' open the file for updating (note that 'w+'
> truncates the file)."
> The term "open the file for updating" means nothing to me in this context.
>> From other place I learned this means that 'w+' means open for both
> writing and reading and creates file if it does not exist and truncates
> file if it exists. 'a+' means appending and reading. 'r+' also means open
> for reading and writing but does not create file if it does not exist, as
> well as does not truncate the file if it does exist.
> I'm still not exactly clear what the difference between 'r+' and 'a+' is
> then, if 'r+' does not truncate the file.
> In any case, I suggest removing the word 'updating' and adding a
> description of what the '+' actually does.
Although this SO question you're linking to probably isn't the best
candidate for a good question (as its score and comments demonstrate), but
underneath it all I find that the reference for C's `fopen` indeed doesn't
use the verb "update".
For example, for "w+" it says:
Open for reading and writing. The file is created if it does not exist,
otherwise it is truncated. The stream is positioned at the beginning of the
So I think this is something that can be considered.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the docs