diff options
author | Christopher Head <chead@chead.ca> | 2019-04-12 15:50:41 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2019-04-12 15:50:40 (GMT) |
commit | b13552c4d7ce68fc9e61b5ade03cb5b951349c2b (patch) | |
tree | b4365351f6ef3028c7f7468a096508c33ee240d4 | |
parent | b015fc86f7b1f35283804bfee788cce0a5495df7 (diff) | |
download | cpython-b13552c4d7ce68fc9e61b5ade03cb5b951349c2b.zip cpython-b13552c4d7ce68fc9e61b5ade03cb5b951349c2b.tar.gz cpython-b13552c4d7ce68fc9e61b5ade03cb5b951349c2b.tar.bz2 |
Indicate that seek and tell are mandatory on BufferedRandom. (GH-11216)
For BufferedReader and BufferedWriter, seek and tell operations are
optional (they may or may not exist based on the underlying stream). For
BufferedRandom, they are mandatory: a BufferedRandom should not be
constructed over an unseekable underlying stream. Document this.
-rw-r--r-- | Doc/library/io.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst index 9738c5c..0f12516 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -719,15 +719,15 @@ than raw I/O does. .. class:: BufferedRandom(raw, buffer_size=DEFAULT_BUFFER_SIZE) A buffered interface to random access streams. It inherits - :class:`BufferedReader` and :class:`BufferedWriter`, and further supports - :meth:`seek` and :meth:`tell` functionality. + :class:`BufferedReader` and :class:`BufferedWriter`. The constructor creates a reader and writer for a seekable raw stream, given in the first argument. If the *buffer_size* is omitted it defaults to :data:`DEFAULT_BUFFER_SIZE`. :class:`BufferedRandom` is capable of anything :class:`BufferedReader` or - :class:`BufferedWriter` can do. + :class:`BufferedWriter` can do. In addition, :meth:`seek` and :meth:`tell` + are guaranteed to be implemented. .. class:: BufferedRWPair(reader, writer, buffer_size=DEFAULT_BUFFER_SIZE) |