summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2015-10-10 10:20:25 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2015-10-10 10:20:25 (GMT)
commita6d5038226e596d9a3f96c6db566a3152ea3bef5 (patch)
treed7377fd16238e421972626d83391711981eedb41 /Doc
parent1431c5af94d91850b514b760313e4fbc4ba932b9 (diff)
parentf26441609310c12826fe4b5bc896aafafa268763 (diff)
downloadcpython-a6d5038226e596d9a3f96c6db566a3152ea3bef5.zip
cpython-a6d5038226e596d9a3f96c6db566a3152ea3bef5.tar.gz
cpython-a6d5038226e596d9a3f96c6db566a3152ea3bef5.tar.bz2
Issue #22413: Merge StringIO doc from 3.5
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/io.rst16
1 files changed, 12 insertions, 4 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index 48fd226..cb3e9ed 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -889,10 +889,16 @@ Text I/O
An in-memory stream for text I/O. The text buffer is discarded when the
:meth:`~IOBase.close` method is called.
- The initial value of the buffer (an empty string by default) can be set by
- providing *initial_value*. The *newline* argument works like that of
- :class:`TextIOWrapper`. The default is to consider only ``\n`` characters
- as end of lines and to do no newline translation.
+ The initial value of the buffer can be set by providing *initial_value*.
+ If newline translation is enabled, newlines will be encoded as if by
+ :meth:`~TextIOBase.write`. The stream is positioned at the start of
+ the buffer.
+
+ The *newline* argument works like that of :class:`TextIOWrapper`.
+ The default is to consider only ``\n`` characters as ends of lines and
+ to do no newline translation. If *newline* is set to ``None``,
+ newlines are written as ``\n`` on all platforms, but universal
+ newline decoding is still performed when reading.
:class:`StringIO` provides this method in addition to those from
:class:`TextIOBase` and its parents:
@@ -900,6 +906,8 @@ Text I/O
.. method:: getvalue()
Return a ``str`` containing the entire contents of the buffer.
+ Newlines are decoded as if by :meth:`~TextIOBase.read`, although
+ the stream position is not changed.
Example usage::