diff options
author | Steve Palmer <steve@srpalmer.me.uk> | 2019-04-09 04:35:27 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2019-04-09 04:35:27 (GMT) |
commit | 7b97ab35b28b761ab1253df427ee674b1a90f465 (patch) | |
tree | a2413ecc43c5bd49be6f11ba8e85e7e0161e6a17 /Doc | |
parent | 8702b67dad62a9084f6c1823dce10653743667c8 (diff) | |
download | cpython-7b97ab35b28b761ab1253df427ee674b1a90f465.zip cpython-7b97ab35b28b761ab1253df427ee674b1a90f465.tar.gz cpython-7b97ab35b28b761ab1253df427ee674b1a90f465.tar.bz2 |
closes bpo-35848: Move all documentation regarding the readinto out of IOBase. (GH-11893)
Move all documentation regarding the readinto method into either io.RawIOBase or io.BufferedIOBase.
Corresponding changes to documentation in the _pyio.py module.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/io.rst | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst index e623a04..9738c5c 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -226,7 +226,7 @@ I/O Base Classes implementations represent a file that cannot be read, written or seeked. - Even though :class:`IOBase` does not declare :meth:`read`, :meth:`readinto`, + Even though :class:`IOBase` does not declare :meth:`read` or :meth:`write` because their signatures will vary, implementations and clients should consider those methods part of the interface. Also, implementations may raise a :exc:`ValueError` (or :exc:`UnsupportedOperation`) @@ -234,9 +234,7 @@ I/O Base Classes The basic type used for binary data read from or written to a file is :class:`bytes`. Other :term:`bytes-like objects <bytes-like object>` are - accepted as method arguments too. In some cases, such as - :meth:`~RawIOBase.readinto`, a writable object such as :class:`bytearray` - is required. Text I/O classes work with :class:`str` data. + accepted as method arguments too. Text I/O classes work with :class:`str` data. Note that calling any method (even inquiries) on a closed stream is undefined. Implementations may raise :exc:`ValueError` in this case. @@ -405,7 +403,8 @@ I/O Base Classes Read bytes into a pre-allocated, writable :term:`bytes-like object` *b*, and return the - number of bytes read. If the object is in non-blocking mode and no bytes + number of bytes read. For example, *b* might be a :class:`bytearray`. + If the object is in non-blocking mode and no bytes are available, ``None`` is returned. .. method:: write(b) @@ -495,6 +494,7 @@ I/O Base Classes Read bytes into a pre-allocated, writable :term:`bytes-like object` *b* and return the number of bytes read. + For example, *b* might be a :class:`bytearray`. Like :meth:`read`, multiple reads may be issued to the underlying raw stream, unless the latter is interactive. @@ -757,8 +757,7 @@ Text I/O .. class:: TextIOBase Base class for text streams. This class provides a character and line based - interface to stream I/O. There is no :meth:`readinto` method because - Python's character strings are immutable. It inherits :class:`IOBase`. + interface to stream I/O. It inherits :class:`IOBase`. There is no public constructor. :class:`TextIOBase` provides or overrides these data attributes and @@ -1048,4 +1047,3 @@ The above implicitly extends to text files, since the :func:`open()` function will wrap a buffered object inside a :class:`TextIOWrapper`. This includes standard streams and therefore affects the built-in function :func:`print()` as well. - |