summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Delfino <adelfino@gmail.com>2019-09-10 13:04:22 (GMT)
committerDino Viehland <dinoviehland@gmail.com>2019-09-10 13:04:22 (GMT)
commitc1d8c1cb8e90a54a3daaa7fcdb8d6ca7f08d6a73 (patch)
tree1b29b0b2adcdbf24185e677b9ebcd05b56228d57
parentb7f8e52433b656a6a524229fd7a65e4682a43729 (diff)
downloadcpython-c1d8c1cb8e90a54a3daaa7fcdb8d6ca7f08d6a73.zip
cpython-c1d8c1cb8e90a54a3daaa7fcdb8d6ca7f08d6a73.tar.gz
cpython-c1d8c1cb8e90a54a3daaa7fcdb8d6ca7f08d6a73.tar.bz2
Note regarding + mode truncation applies to both text and binary mode (#11314)
* Improve doc on open's mode + * Improve wording * Address comment from RĂ©mi
-rw-r--r--Doc/library/functions.rst6
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index ce026eb..98a55c6 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1070,12 +1070,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*