cpython: 30a026a25167 (original) (raw)

--- a/Doc/library/collections.abc.rst +++ b/Doc/library/collections.abc.rst @@ -28,10 +28,10 @@ example, whether it is hashable or wheth Collections Abstract Base Classes --------------------------------- -The collections module offers the following ABCs: +The collections module offers the following :term:ABCs <abstract base class>: ========================= ===================== ====================== ==================================================== -ABC Inherits Abstract Methods Mixin Methods +ABC Inherits from Abstract Methods Mixin Methods ========================= ===================== ====================== ==================================================== :class:Container __contains__ :class:Hashable __hash__ @@ -44,15 +44,15 @@ ABC Inherits :class:Iterable, index, and count :class:Container -:class:MutableSequence :class:Sequence __setitem__ Inherited Sequence methods and +:class:MutableSequence :class:Sequence __setitem__ Inherited :class:Sequence methods and __delitem__, append, reverse, extend, pop,

:class:Set :class:Sized, __le__, __lt__, __eq__, __ne__, :class:Iterable, __gt__, __ge__, __and__, __or__, :class:Container __sub__, __xor__, and isdisjoint -:class:MutableSet :class:Set add and Inherited Set methods and +:class:MutableSet :class:Set add, Inherited :class:Set methods and discard clear, pop, remove, __ior__, __iand__, __ixor__, and __isub__ @@ -60,19 +60,61 @@ ABC Inherits :class:Iterable, get, __eq__, and __ne__ :class:Container -:class:MutableMapping :class:Mapping __setitem__ and Inherited Mapping methods and +:class:MutableMapping :class:Mapping __setitem__, Inherited :class:Mapping methods and __delitem__ pop, popitem, clear, update, and setdefault :class:MappingView :class:Sized __len__ -:class:KeysView :class:MappingView, __contains__, +:class:ItemsView :class:MappingView, __contains__, :class:Set __iter__ -:class:ItemsView :class:MappingView, __contains__, +:class:KeysView :class:MappingView, __contains__, :class:Set __iter__ :class:ValuesView :class:MappingView __contains__, __iter__ ========================= ===================== ====================== ==================================================== + +.. class:: Container

+

+.. class:: Iterable +

+.. class:: Iterator +

+.. class:: Sequence

+

+.. class:: Set

+

+.. class:: Mapping

+

+.. class:: MappingView

+

+ These ABCs allow us to ask classes or instances if they provide particular functionality, for example::