summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2019-01-27 16:21:11 (GMT)
committerGitHub <noreply@github.com>2019-01-27 16:21:11 (GMT)
commit3171df34141c1f26ec16dccb4357184c0cf6c58f (patch)
treea1700c6745b2c0154f0f5682de016f1ea153fd9f
parent81d04bcf2124341aa73e5c13c1f1c4bdd3f5dbef (diff)
downloadcpython-3171df34141c1f26ec16dccb4357184c0cf6c58f.zip
cpython-3171df34141c1f26ec16dccb4357184c0cf6c58f.tar.gz
cpython-3171df34141c1f26ec16dccb4357184c0cf6c58f.tar.bz2
Clarify U-mode deprecation in open() (GH-11646)
The previous wording could be read as saying that universal newlines mode itself was deprecated, when it's only the 'U' character in the mode field that should be avoided. The update also moves the description of the 'U' mode character out of the mode table, as the longer explanation was overly intrusive as a table entry and overshadowed the actually useful mode characters.
-rw-r--r--Doc/library/functions.rst9
1 files changed, 8 insertions, 1 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index b49d752..cca28ff 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1004,7 +1004,6 @@ are always available. They are listed here in alphabetical order.
``'b'`` binary mode
``'t'`` text mode (default)
``'+'`` open a disk file for updating (reading and writing)
- ``'U'`` :term:`universal newlines` mode (deprecated)
========= ===============================================================
The default mode is ``'r'`` (open for reading text, synonym of ``'rt'``).
@@ -1019,6 +1018,12 @@ are always available. They are listed here in alphabetical order.
first decoded using a platform-dependent encoding or using the specified
*encoding* if given.
+ There is an additional mode character permitted, ``'U'``, which no longer
+ has any effect, and is considered deprecated. It previously enabled
+ :term:`universal newlines` in text mode, which became the default behaviour
+ in Python 3.0. Refer to the documentation of the
+ :ref:`newline <open-newline-parameter>` parameter for further details.
+
.. note::
Python doesn't depend on the underlying operating system's notion of text
@@ -1085,6 +1090,8 @@ are always available. They are listed here in alphabetical order.
.. index::
single: universal newlines; open() built-in function
+ .. _open-newline-parameter:
+
*newline* controls how :term:`universal newlines` mode works (it only
applies to text mode). It can be ``None``, ``''``, ``'\n'``, ``'\r'``, and
``'\r\n'``. It works as follows: