summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-08-17 20:38:19 -0400
committerR David Murray <rdmurray@bitdance.com>2012-08-17 20:38:19 -0400
commit355d6e90f2c04f1c0b7c0b6a3b7162bc04fd413a (patch)
tree239ee0cf2504a1155a6e236f90cec2a26c9d0d01
parent81ba0dc2b139d06b8bd073ed10adcbfda214794d (diff)
parent7187b85a913adf71be9724ab8c80986bdbde342f (diff)
downloadcpython-355d6e90f2c04f1c0b7c0b6a3b7162bc04fd413a.tar.gz
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.
-rw-r--r--Doc/library/functions.rst10
-rw-r--r--Doc/library/io.rst14
2 files changed, 16 insertions, 8 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index de29a1ae22..e063895428 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
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index 3a8ddd00d0..e83e55ca55 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -16,11 +16,15 @@
Overview
--------
-The :mod:`io` module provides Python's main facilities for dealing for various
-types of I/O. There are three main types of I/O: *text I/O*, *binary I/O*, *raw
-I/O*. These are generic categories, and various backing stores can be used for
-each of them. Concrete objects belonging to any of these categories will often
-be called *streams*; another common term is *file-like objects*.
+.. index::
+ single: file object; io module
+
+The :mod:`io` module provides Python's main facilities for dealing with various
+types of I/O. There are three main types of I/O: *text I/O*, *binary I/O*
+and *raw I/O*. These are generic categories, and various backing stores can
+be used for each of them. A concrete object belonging to any of these
+categories is called a :term:`file object`. Other common terms are *stream*
+and *file-like object*.
Independently of its category, each concrete stream object will also have
various capabilities: it can be read-only, write-only, or read-write. It can