summaryrefslogtreecommitdiffstats
path: root/Doc/library/io.rst
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-08-15 14:43:58 (GMT)
committerR David Murray <rdmurray@bitdance.com>2012-08-15 14:43:58 (GMT)
commit1b00f25bf99d9b7a5f307984f6467258de636d23 (patch)
tree18d19d268ea3a642be447d3f7041211dc40f9379 /Doc/library/io.rst
parentf748a3773fd40dd91195fc2fef2cac2f973baaf8 (diff)
downloadcpython-1b00f25bf99d9b7a5f307984f6467258de636d23.zip
cpython-1b00f25bf99d9b7a5f307984f6467258de636d23.tar.gz
cpython-1b00f25bf99d9b7a5f307984f6467258de636d23.tar.bz2
#15543: glossary entry for and 'universal newlines', and links to it.
Patch by Chris Jerdonek.
Diffstat (limited to 'Doc/library/io.rst')
-rw-r--r--Doc/library/io.rst17
1 files changed, 12 insertions, 5 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index b302c64..8e6e601 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -757,13 +757,17 @@ Text I/O
sequences) can be used. Any other error handling name that has been
registered with :func:`codecs.register_error` is also valid.
+ .. index::
+ single: universal newlines; io.TextIOWrapper class
+
*newline* controls how line endings are handled. It can be ``None``,
``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``. It works as follows:
- * When reading input from the stream, if *newline* is ``None``, universal
- newlines mode is enabled. Lines in the input can end in ``'\n'``,
+ * When reading input from the stream, if *newline* is ``None``,
+ :term:`universal newlines` mode is enabled. Lines in the input can end
+ in ``'\n'``,
``'\r'``, or ``'\r\n'``, and these are translated into ``'\n'`` before
- being returned to the caller. If it is ``''``, universal newline mode is
+ being returned to the caller. If it is ``''``, universal newlines mode is
enabled, but line endings are returned to the caller untranslated. If it
has any of the other legal values, input lines are only terminated by the
given string, and the line ending is returned to the caller untranslated.
@@ -819,10 +823,13 @@ Text I/O
output.close()
+.. index::
+ single: universal newlines; io.IncrementalNewlineDecoder class
+
.. class:: IncrementalNewlineDecoder
- A helper codec that decodes newlines for universal newlines mode. It
- inherits :class:`codecs.IncrementalDecoder`.
+ A helper codec that decodes newlines for :term:`universal newlines` mode.
+ It inherits :class:`codecs.IncrementalDecoder`.
Performance