Skip to content

Commit eb690eb

Browse files
add doc about attribute name and mode in module io
1 parent 9c4ff8a commit eb690eb

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Doc/library/io.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,9 @@ than raw I/O does.
765765

766766
A buffered binary stream providing higher-level access to a readable, non
767767
seekable :class:`RawIOBase` raw binary stream. It inherits from
768-
:class:`BufferedIOBase`.
768+
:class:`BufferedIOBase`. :class:`BufferedReader` stores a :class:`FileIO`
769+
object in its *raw* attribute, which is why it exposes properties such as
770+
*name* and *mode*.
769771

770772
When reading data from this object, a larger amount of data may be
771773
requested from the underlying raw stream, and kept in an internal buffer.
@@ -799,7 +801,9 @@ than raw I/O does.
799801

800802
A buffered binary stream providing higher-level access to a writeable, non
801803
seekable :class:`RawIOBase` raw binary stream. It inherits from
802-
:class:`BufferedIOBase`.
804+
:class:`BufferedIOBase`. :class:`BufferedWriter` stores a :class:`FileIO`
805+
object in its *raw* attribute, which is why it exposes properties such as
806+
*name* and *mode*.
803807

804808
When writing to this object, data is normally placed into an internal
805809
buffer. The buffer will be written out to the underlying :class:`RawIOBase`
@@ -963,7 +967,10 @@ Text I/O
963967

964968
A buffered text stream providing higher-level access to a
965969
:class:`BufferedIOBase` buffered binary stream. It inherits from
966-
:class:`TextIOBase`.
970+
:class:`TextIOBase`. :class:`TextIOWrapper` stores an object of type
971+
:class:`BufferedReader`, :class:`BufferedWriter`, or :class:`BufferedRandom`
972+
in its internal *buffer* attribute, which is why it exposes properties such
973+
as *name* and *mode*.
967974

968975
*encoding* gives the name of the encoding that the stream will be decoded or
969976
encoded with. In :ref:`UTF-8 Mode <utf8-mode>`, this defaults to UTF-8.

0 commit comments

Comments
 (0)