[Python-checkins] cpython (3.1): #10617: add class directives to collections ABCs.

ezio.melotti python-checkins at python.org
Mon Mar 28 18:27:29 CEST 2011


http://hg.python.org/cpython/rev/c5de208d205c
changeset: 69024:c5de208d205c
branch: 3.1
parent: 69018:f3d96d28a86e
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Mon Mar 28 13:50:41 2011 +0300
summary:
 #10617: add class directives to collections ABCs.
files:
 Doc/library/collections.rst | 58 +++++++++++++++++++++---
 1 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -907,10 +907,10 @@
 ABCs - 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__``
@@ -923,15 +923,15 @@
 :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``,
- and ``insert`` ``remove``, and ``__iadd__``
+ ``insert`` ``remove``, and ``__iadd__``
 
 :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__``
 
@@ -939,19 +939,61 @@
 :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:`ItemsView` :class:`MappingView`, ``__contains__``,
+ :class:`Set` ``__iter__``
 :class:`KeysView` :class:`MappingView`, ``__contains__``,
 :class:`Set` ``__iter__``
-:class:`ItemsView` :class:`MappingView`, ``__contains__``,
- :class:`Set` ``__iter__``
 :class:`ValuesView` :class:`MappingView` ``__contains__``, ``__iter__``
 ========================= ===================== ====================== ====================================================
 
+
+.. class:: Container
+ Hashable
+ Sized
+ Callable
+
+ ABCs for classes that provide respectively the methods :meth:`__contains__`,
+ :meth:`__hash__`, :meth:`__len__`, and :meth:`__call__`.
+
+.. class:: Iterable
+
+ ABC for classes that provide the :meth:`__iter__` method.
+ See also the definition of :term:`iterable`.
+
+.. class:: Iterator
+
+ ABC for classes that provide the :meth:`__iter__` and :meth:`next` methods.
+ See also the definition of :term:`iterator`.
+
+.. class:: Sequence
+ MutableSequence
+
+ ABCs for read-only and mutable :term:`sequences <sequence>`.
+
+.. class:: Set
+ MutableSet
+
+ ABCs for read-only and mutable sets.
+
+.. class:: Mapping
+ MutableMapping
+
+ ABCs for read-only and mutable :term:`mappings <mapping>`.
+
+.. class:: MappingView
+ ItemsView
+ KeysView
+ ValuesView
+
+ ABCs for mapping, items, keys, and values :term:`views <view>`.
+
+
 These ABCs allow us to ask classes or instances if they provide
 particular functionality, for example::
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /