summaryrefslogtreecommitdiffstats
path: root/Doc/reference/datamodel.rst
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-10-09 11:02:14 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-10-09 11:02:14 (GMT)
commitad16b725bcd55e43982858a6736e7adcf553aeff (patch)
tree6eda0b040551dcdf69c1932c210cac5250f39b3e /Doc/reference/datamodel.rst
parent99a196fcfcc400880b53761fda3d373168411362 (diff)
downloadcpython-ad16b725bcd55e43982858a6736e7adcf553aeff.zip
cpython-ad16b725bcd55e43982858a6736e7adcf553aeff.tar.gz
cpython-ad16b725bcd55e43982858a6736e7adcf553aeff.tar.bz2
Issue #19190: Improve cross-references in builtin types and functions documentation.
Diffstat (limited to 'Doc/reference/datamodel.rst')
-rw-r--r--Doc/reference/datamodel.rst36
1 files changed, 19 insertions, 17 deletions
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 @@ Set types
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 @@ Callable types
: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 @@ Classes
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 @@ Class instances
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 @@ Internal types
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 @@ When implementing a class that emulates any built-in type, it is important that
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 @@ case the instance is itself a class.
: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 @@ range of items. (For backwards compatibility, the method :meth:`__getslice__`
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