Issue #19190: Improve cross-references in builtin types and functions documentation.
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index aa0a587..b57b65e 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -411,7 +411,7 @@
These represent a mutable set. They are created by the built-in :func:`set`
constructor and can be modified afterwards by several methods, such as
- :meth:`add`.
+ :meth:`~set.add`.
Frozen sets
.. index:: object: frozenset
@@ -661,7 +661,8 @@
:ref:`yield`) is called a :dfn:`generator
function`. Such a function, when called, always returns an iterator object
which can be used to execute the body of the function: calling the iterator's
- :meth:`next` method will cause the function to execute until it provides a value
+ :meth:`~iterator.next` method will cause the function to execute until
+ it provides a value
using the :keyword:`yield` statement. When the function executes a
:keyword:`return` statement or falls off the end, a :exc:`StopIteration`
exception is raised and the iterator will have reached the end of the set of
@@ -821,10 +822,10 @@
Special attributes: :attr:`__name__` is the class name; :attr:`__module__` is
the module name in which the class was defined; :attr:`__dict__` is the
- dictionary containing the class's namespace; :attr:`__bases__` is a tuple
- (possibly empty or a singleton) containing the base classes, in the order of
- their occurrence in the base class list; :attr:`__doc__` is the class's
- documentation string, or None if undefined.
+ dictionary containing the class's namespace; :attr:`~class.__bases__` is a
+ tuple (possibly empty or a singleton) containing the base classes, in the
+ order of their occurrence in the base class list; :attr:`__doc__` is the
+ class's documentation string, or None if undefined.
Class instances
.. index::
@@ -869,8 +870,8 @@
single: __dict__ (instance attribute)
single: __class__ (instance attribute)
- Special attributes: :attr:`__dict__` is the attribute dictionary;
- :attr:`__class__` is the instance's class.
+ Special attributes: :attr:`~object.__dict__` is the attribute dictionary;
+ :attr:`~instance.__class__` is the instance's class.
Files
.. index::
@@ -1069,9 +1070,9 @@
single: stop (slice object attribute)
single: step (slice object attribute)
- Special read-only attributes: :attr:`start` is the lower bound; :attr:`stop` is
- the upper bound; :attr:`step` is the step value; each is ``None`` if omitted.
- These attributes can have any type.
+ Special read-only attributes: :attr:`~slice.start` is the lower bound;
+ :attr:`~slice.stop` is the upper bound; :attr:`~slice.step` is the step
+ value; each is ``None`` if omitted. These attributes can have any type.
Slice objects support one method:
@@ -1178,7 +1179,8 @@
the emulation only be implemented to the degree that it makes sense for the
object being modelled. For example, some sequences may work well with retrieval
of individual elements, but extracting a slice may not make sense. (One example
-of this is the :class:`NodeList` interface in the W3C's Document Object Model.)
+of this is the :class:`~xml.dom.NodeList` interface in the W3C's Document
+Object Model.)
.. _customization:
@@ -1810,10 +1812,10 @@
:pep:`3119` - Introducing Abstract Base Classes
Includes the specification for customizing :func:`isinstance` and
- :func:`issubclass` behavior through :meth:`__instancecheck__` and
- :meth:`__subclasscheck__`, with motivation for this functionality in the
- context of adding Abstract Base Classes (see the :mod:`abc` module) to the
- language.
+ :func:`issubclass` behavior through :meth:`~class.__instancecheck__` and
+ :meth:`~class.__subclasscheck__`, with motivation for this functionality
+ in the context of adding Abstract Base Classes (see the :mod:`abc`
+ module) to the language.
.. _callable-types:
@@ -1846,7 +1848,7 @@
is also recommended that mappings provide the methods :meth:`keys`,
:meth:`values`, :meth:`items`, :meth:`has_key`, :meth:`get`, :meth:`clear`,
:meth:`setdefault`, :meth:`iterkeys`, :meth:`itervalues`, :meth:`iteritems`,
-:meth:`pop`, :meth:`popitem`, :meth:`copy`, and :meth:`update` behaving similar
+:meth:`pop`, :meth:`popitem`, :meth:`!copy`, and :meth:`update` behaving similar
to those for Python's standard dictionary objects. The :mod:`UserDict` module
provides a :class:`DictMixin` class to help create those methods from a base set
of :meth:`__getitem__`, :meth:`__setitem__`, :meth:`__delitem__`, and
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 1e46af2..d3dc111 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -431,6 +431,7 @@
is already executing raises a :exc:`ValueError` exception.
.. index:: exception: StopIteration
+.. class:: generator
.. method:: generator.next()
@@ -444,6 +445,7 @@
exits without yielding another value, a :exc:`StopIteration` exception is
raised.
+.. class:: .
.. method:: generator.send(value)
@@ -660,10 +662,10 @@
conversion of the lone slice item is the key. The conversion of a slice item
that is an expression is that expression. The conversion of an ellipsis slice
item is the built-in ``Ellipsis`` object. The conversion of a proper slice is a
-slice object (see section :ref:`types`) whose :attr:`start`, :attr:`stop` and
-:attr:`step` attributes are the values of the expressions given as lower bound,
-upper bound and stride, respectively, substituting ``None`` for missing
-expressions.
+slice object (see section :ref:`types`) whose :attr:`~slice.start`,
+:attr:`~slice.stop` and :attr:`~slice.step` attributes are the values of the
+expressions given as lower bound, upper bound and stride, respectively,
+substituting ``None`` for missing expressions.
.. index::