]> granicus.if.org Git - python/commitdiff
Issue #15624: clarify newline documentation for open and io.TextIOWrapper
authorAndrew Svetlov <andrew.svetlov@gmail.com>
Mon, 13 Aug 2012 09:58:02 +0000 (12:58 +0300)
committerAndrew Svetlov <andrew.svetlov@gmail.com>
Mon, 13 Aug 2012 09:58:02 +0000 (12:58 +0300)
Thanks to Chris Jerdonek

Doc/library/functions.rst
Doc/library/io.rst

index 5d6a5fed0aa74125a5ea3f188062060aecbaa881..ffc34d88337a183695d667fa9c8706c4ad2788f5 100644 (file)
@@ -878,18 +878,21 @@ are always available.  They are listed here in alphabetical order.
    mode).  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 *closefd* is ``False`` and a file descriptor rather than a filename was
index 9aecc7db6bf7cb9fea8c68421d316c60b295e124..09e050196cec5c8c579be8134cfc368a4a36c254 100644 (file)
@@ -760,18 +760,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