summaryrefslogtreecommitdiffstats
path: root/Doc/library/io.rst
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-08-13 09:59:00 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-08-13 09:59:00 (GMT)
commite4b1a189a763824c226d804e5e73b826e7d7b70f (patch)
treead4044eb2318c5feb8f07d2f1bbb558fab503fd2 /Doc/library/io.rst
parentb2d850248502ea3d76af42476661e40812986273 (diff)
parentecd78feb7896239e062b8085c073affb8fd1fafa (diff)
downloadcpython-e4b1a189a763824c226d804e5e73b826e7d7b70f.zip
cpython-e4b1a189a763824c226d804e5e73b826e7d7b70f.tar.gz
cpython-e4b1a189a763824c226d804e5e73b826e7d7b70f.tar.bz2
Issue #15624: clarify newline documentation for open and io.TextIOWrapper
Thanks to Chris Jerdonek
Diffstat (limited to 'Doc/library/io.rst')
-rw-r--r--Doc/library/io.rst27
1 files changed, 15 insertions, 12 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index aeaf56b..2a3c5d8 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -770,18 +770,21 @@ Text I/O
*newline* controls how line endings are handled. It can be ``None``,
``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``. It works as follows:
- * On input, if *newline* is ``None``, 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 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.
-
- * On output, if *newline* is ``None``, any ``'\n'`` characters written are
- translated to the system default line separator, :data:`os.linesep`. If
- *newline* is ``''`` or ``'\n'``, no translation takes place. If *newline*
- is any of the other legal values, any ``'\n'`` characters written are
+ * When reading input from the stream, if *newline* is ``None``,
+ 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 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.
+
+ * When writing output to the stream, if *newline* is ``None``, any
+ ``'\n'`` characters written are translated to the system default
+ line separator, :data:`os.linesep`. If *newline* is ``''`` or
+ ``'\n'``, no translation takes place. If *newline* is any of the
+ other legal values, any ``'\n'`` characters written are
translated to the given string.
If *line_buffering* is ``True``, :meth:`flush` is implied when a call to