Skip to content

Commit b13552c

Browse files
Hawk777benjaminp
authored andcommitted
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.
1 parent b015fc8 commit b13552c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/library/io.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -719,15 +719,15 @@ than raw I/O does.
719719
.. class:: BufferedRandom(raw, buffer_size=DEFAULT_BUFFER_SIZE)
720720

721721
A buffered interface to random access streams. It inherits
722-
:class:`BufferedReader` and :class:`BufferedWriter`, and further supports
723-
:meth:`seek` and :meth:`tell` functionality.
722+
:class:`BufferedReader` and :class:`BufferedWriter`.
724723

725724
The constructor creates a reader and writer for a seekable raw stream, given
726725
in the first argument. If the *buffer_size* is omitted it defaults to
727726
:data:`DEFAULT_BUFFER_SIZE`.
728727

729728
:class:`BufferedRandom` is capable of anything :class:`BufferedReader` or
730-
:class:`BufferedWriter` can do.
729+
:class:`BufferedWriter` can do. In addition, :meth:`seek` and :meth:`tell`
730+
are guaranteed to be implemented.
731731

732732

733733
.. class:: BufferedRWPair(reader, writer, buffer_size=DEFAULT_BUFFER_SIZE)

0 commit comments

Comments
 (0)