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

Skip to content

Commit 9b2e67c

Browse files
committed
#10617: add class directives to collections ABCs.
1 parent f8d887e commit 9b2e67c

1 file changed

Lines changed: 50 additions & 8 deletions

File tree

Doc/library/collections.rst

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -907,10 +907,10 @@ attribute.
907907
ABCs - abstract base classes
908908
----------------------------
909909

910-
The collections module offers the following ABCs:
910+
The collections module offers the following :term:`ABCs <abstract base class>`:
911911

912912
========================= ===================== ====================== ====================================================
913-
ABC Inherits Abstract Methods Mixin Methods
913+
ABC Inherits from Abstract Methods Mixin Methods
914914
========================= ===================== ====================== ====================================================
915915
:class:`Container` ``__contains__``
916916
:class:`Hashable` ``__hash__``
@@ -923,35 +923,77 @@ ABC Inherits Abstract Methods Mixin
923923
:class:`Iterable`, ``index``, and ``count``
924924
:class:`Container`
925925

926-
:class:`MutableSequence` :class:`Sequence` ``__setitem__`` Inherited Sequence methods and
926+
:class:`MutableSequence` :class:`Sequence` ``__setitem__``, Inherited :class:`Sequence` methods and
927927
``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``,
928-
and ``insert`` ``remove``, and ``__iadd__``
928+
``insert`` ``remove``, and ``__iadd__``
929929

930930
:class:`Set` :class:`Sized`, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``,
931931
:class:`Iterable`, ``__gt__``, ``__ge__``, ``__and__``, ``__or__``,
932932
:class:`Container` ``__sub__``, ``__xor__``, and ``isdisjoint``
933933

934-
:class:`MutableSet` :class:`Set` ``add`` and Inherited Set methods and
934+
:class:`MutableSet` :class:`Set` ``add``, Inherited :class:`Set` methods and
935935
``discard`` ``clear``, ``pop``, ``remove``, ``__ior__``,
936936
``__iand__``, ``__ixor__``, and ``__isub__``
937937

938938
:class:`Mapping` :class:`Sized`, ``__getitem__`` ``__contains__``, ``keys``, ``items``, ``values``,
939939
:class:`Iterable`, ``get``, ``__eq__``, and ``__ne__``
940940
:class:`Container`
941941

942-
:class:`MutableMapping` :class:`Mapping` ``__setitem__`` and Inherited Mapping methods and
942+
:class:`MutableMapping` :class:`Mapping` ``__setitem__``, Inherited :class:`Mapping` methods and
943943
``__delitem__`` ``pop``, ``popitem``, ``clear``, ``update``,
944944
and ``setdefault``
945945

946946

947947
:class:`MappingView` :class:`Sized` ``__len__``
948-
:class:`KeysView` :class:`MappingView`, ``__contains__``,
949-
:class:`Set` ``__iter__``
950948
:class:`ItemsView` :class:`MappingView`, ``__contains__``,
951949
:class:`Set` ``__iter__``
950+
:class:`KeysView` :class:`MappingView`, ``__contains__``,
951+
:class:`Set` ``__iter__``
952952
:class:`ValuesView` :class:`MappingView` ``__contains__``, ``__iter__``
953953
========================= ===================== ====================== ====================================================
954954

955+
956+
.. class:: Container
957+
Hashable
958+
Sized
959+
Callable
960+
961+
ABCs for classes that provide respectively the methods :meth:`__contains__`,
962+
:meth:`__hash__`, :meth:`__len__`, and :meth:`__call__`.
963+
964+
.. class:: Iterable
965+
966+
ABC for classes that provide the :meth:`__iter__` method.
967+
See also the definition of :term:`iterable`.
968+
969+
.. class:: Iterator
970+
971+
ABC for classes that provide the :meth:`__iter__` and :meth:`next` methods.
972+
See also the definition of :term:`iterator`.
973+
974+
.. class:: Sequence
975+
MutableSequence
976+
977+
ABCs for read-only and mutable :term:`sequences <sequence>`.
978+
979+
.. class:: Set
980+
MutableSet
981+
982+
ABCs for read-only and mutable sets.
983+
984+
.. class:: Mapping
985+
MutableMapping
986+
987+
ABCs for read-only and mutable :term:`mappings <mapping>`.
988+
989+
.. class:: MappingView
990+
ItemsView
991+
KeysView
992+
ValuesView
993+
994+
ABCs for mapping, items, keys, and values :term:`views <view>`.
995+
996+
955997
These ABCs allow us to ask classes or instances if they provide
956998
particular functionality, for example::
957999

0 commit comments

Comments
 (0)