[Python-checkins] Note regarding + mode truncation applies to both text and binary mode (GH-11314) (GH-15869)

Gregory P. Smith webhook-mailer at python.org
Tue Sep 10 11:05:00 EDT 2019


https://github.com/python/cpython/commit/80722308820c112f0e473f2353f550d5aeb90352
commit: 80722308820c112f0e473f2353f550d5aeb90352
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Gregory P. Smith <greg at krypto.org>
date: 2019-09-10T16:04:56+01:00
summary:

Note regarding + mode truncation applies to both text and binary mode (GH-11314) (GH-15869)

* Improve doc on open's mode +

* Improve wording

* Address comment from Rémi
(cherry picked from commit c1d8c1cb8e90a54a3daaa7fcdb8d6ca7f08d6a73)

Co-authored-by: Andre Delfino <adelfino at gmail.com>

files:
M Doc/library/functions.rst

diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index c748b086d8ac..a4097b0b30ec 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1068,12 +1068,12 @@ are always available.  They are listed here in alphabetical order.
    ``'a'``   open for writing, appending to the end of the file if it exists
    ``'b'``   binary mode
    ``'t'``   text mode (default)
-   ``'+'``   open a disk file for updating (reading and writing)
+   ``'+'``   open for updating (reading and writing)
    ========= ===============================================================
 
    The default mode is ``'r'`` (open for reading text, synonym of ``'rt'``).
-   For binary read-write access, the mode ``'w+b'`` opens and truncates the file
-   to 0 bytes.  ``'r+b'`` opens the file without truncation.
+   Modes ``'w+'`` and ``'w+b'`` opens and truncates the file.  Modes ``'r+'``
+   and ``'r+b'`` opens the file with no truncation.
 
    As mentioned in the :ref:`io-overview`, Python distinguishes between binary
    and text I/O.  Files opened in binary mode (including ``'b'`` in the *mode*



More information about the Python-checkins mailing list