Skip to content

Clarify U-mode deprecation in open() #11646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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'``).
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down