diff options
author | R David Murray <rdmurray@bitdance.com> | 2012-08-18 00:38:19 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2012-08-18 00:38:19 (GMT) |
commit | 8eac575e817f6874f3dd34b0b6bed5c8b1011131 (patch) | |
tree | fe8b4d86089054ff5076cc3bcbd58416e16bde6b /Doc/library/functions.rst | |
parent | 5c3ddc8066993199a6af25ce9011ae587a60117b (diff) | |
parent | 9f0c9401d364cae9ef366e50ded1faf156c32ef0 (diff) | |
download | cpython-8eac575e817f6874f3dd34b0b6bed5c8b1011131.zip cpython-8eac575e817f6874f3dd34b0b6bed5c8b1011131.tar.gz cpython-8eac575e817f6874f3dd34b0b6bed5c8b1011131.tar.bz2 |
Merge #15694: Link discussion of file objects to glossary entry.
This is analogous to the link for `flie objects` in the description of
'open' that exists in the 2.7 docs, and adds a similar link to the
io docs.
Patch by Chris Jerdonek.
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r-- | Doc/library/functions.rst | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index de29a1a..e063895 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -787,10 +787,13 @@ are always available. They are listed here in alphabetical order. :meth:`__index__` method that returns an integer. + .. index:: + single: file object; open() built-in function + .. function:: open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) - Open *file* and return a corresponding stream. If the file cannot be opened, - an :exc:`OSError` is raised. + Open *file* and return a corresponding :term:`file object`. If the file + cannot be opened, an :exc:`OSError` is raised. *file* is either a string or bytes object giving the pathname (absolute or relative to the current working directory) of the file to be opened or @@ -910,7 +913,8 @@ are always available. They are listed here in alphabetical order. The *opener* parameter was added. The ``'x'`` mode was added. - The type of file object returned by the :func:`open` function depends on the + The type of :term:`file object` returned by the :func:`open` function + depends on the mode. When :func:`open` is used to open a file in a text mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass of :class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When used |