]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Note regarding + mode truncation applies to both text and binary mode (GH-11314)...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 10 Sep 2019 15:04:56 +0000 (08:04 -0700)
committerGregory P. Smith <greg@krypto.org>
Tue, 10 Sep 2019 15:04:56 +0000 (16:04 +0100)
* Improve doc on open's mode +

* Improve wording

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

Co-authored-by: Andre Delfino <adelfino@gmail.com>
Doc/library/functions.rst

index c748b086d8acae8449327e2a0ed4e25aa8cc7670..a4097b0b30eca2a497d71fe9403e784f5317ebbc 100644 (file)
@@ -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*