Skip to content

Commit 7e22940

Browse files
Update functions.rst
[doc] Clarify that open() file param is saved as name attribute
1 parent f893e8f commit 7e22940

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Doc/library/functions.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,12 @@ are always available. They are listed here in alphabetical order.
14941494
disabled, the raw stream, a subclass of :class:`io.RawIOBase`,
14951495
:class:`io.FileIO`, is returned.
14961496

1497+
The *file* argument is saved as the :attr:`~io.IOBase.name` attribute of
1498+
the returned file object. If *file* is given as a string or bytes object,
1499+
it will be saved as-is. If it is given as an integer file descriptor,
1500+
the :attr:`~io.IOBase.name` attribute will contain the file descriptor value.
1501+
For other object types, the representation of the object will be stored.
1502+
14971503
.. index::
14981504
single: line-buffered I/O
14991505
single: unbuffered I/O
@@ -1540,6 +1546,10 @@ are always available. They are listed here in alphabetical order.
15401546
.. versionchanged:: 3.11
15411547
The ``'U'`` mode has been removed.
15421548

1549+
.. versionchanged:: 3.13
1550+
Clarified that the *file* argument is saved as the :attr:`~io.IOBase.name`
1551+
attribute.
1552+
15431553
.. function:: ord(character, /)
15441554

15451555
Return the ordinal value of a character.

0 commit comments

Comments
 (0)