Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa088db

Browse files
committed
Improve glossary entry for ABCs.
- Rename reST target name for collections ABCs to avoid collisions - Add link to importlib ABCs (collections, numbers and io ABCs were already linked) - Link to glossary entry from numbers module doc (other modules already do it)
1 parent 07e58c3 commit fa088db

4 files changed

Lines changed: 16 additions & 13 deletions

File tree

Doc/glossary.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ Glossary
2727
:ref:`2to3-reference`.
2828

2929
abstract base class
30-
:ref:`abstract-base-classes` complement :term:`duck-typing` by
30+
Abstract base classes complement :term:`duck-typing` by
3131
providing a way to define interfaces when other techniques like
32-
:func:`hasattr` would be clumsy. Python comes with many built-in ABCs for
32+
:func:`hasattr` would be clumsy or subtly wrong (for example with
33+
:ref:`magic methods <special-lookup>`). Python comes with many built-in ABCs for
3334
data structures (in the :mod:`collections` module), numbers (in the
34-
:mod:`numbers` module), and streams (in the :mod:`io` module). You can
35-
create your own ABC with the :mod:`abc` module.
35+
:mod:`numbers` module), streams (in the :mod:`io` module), import finders
36+
and loaders (in the :mod:`importlib.abc` module). You can create your own
37+
ABCs with the :mod:`abc` module.
3638

3739
argument
3840
A value passed to a function or method, assigned to a named local
@@ -430,8 +432,8 @@ Glossary
430432
mapping
431433
A container object that supports arbitrary key lookups and implements the
432434
methods specified in the :class:`Mapping` or :class:`MutableMapping`
433-
:ref:`abstract base classes <abstract-base-classes>`. Examples include
434-
:class:`dict`, :class:`collections.defaultdict`,
435+
:ref:`abstract base classes <collections-abstract-base-classes>`. Examples
436+
include :class:`dict`, :class:`collections.defaultdict`,
435437
:class:`collections.OrderedDict` and :class:`collections.Counter`.
436438

437439
metaclass

Doc/library/abc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
--------------
1313

1414
This module provides the infrastructure for defining an :term:`abstract base
15-
class` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this
15+
class` (ABC) in Python, as outlined in :pep:`3119`; see the PEP for why this
1616
was added to Python. (See also :pep:`3141` and the :mod:`numbers` module
1717
regarding a type hierarchy for numbers based on ABCs.)
1818

Doc/library/collections.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ Python's general purpose built-in containers, :class:`dict`, :class:`list`,
3333
===================== ====================================================================
3434

3535
In addition to the concrete container classes, the collections module provides
36-
:ref:`abstract-base-classes` that can be used to test whether a class provides a
37-
particular interface, for example, whether it is hashable or a mapping.
36+
:ref:`abstract base classes <collections-abstract-base-classes>` that can be
37+
used to test whether a class provides a particular interface, for example,
38+
whether it is hashable or a mapping.
3839

3940

4041
:class:`Counter` objects
@@ -984,7 +985,7 @@ attribute.
984985
subclass) or an arbitrary sequence which can be converted into a string using
985986
the built-in :func:`str` function.
986987

987-
.. _abstract-base-classes:
988+
.. _collections-abstract-base-classes:
988989

989990
ABCs - abstract base classes
990991
----------------------------

Doc/library/numbers.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
:synopsis: Numeric abstract base classes (Complex, Real, Integral, etc.).
66

77

8-
The :mod:`numbers` module (:pep:`3141`) defines a hierarchy of numeric abstract
9-
base classes which progressively define more operations. None of the types
10-
defined in this module can be instantiated.
8+
The :mod:`numbers` module (:pep:`3141`) defines a hierarchy of numeric
9+
:term:`abstract base classes <abstract base class>` which progressively define
10+
more operations. None of the types defined in this module can be instantiated.
1111

1212

1313
.. class:: Number

0 commit comments

Comments
 (0)