summaryrefslogtreecommitdiffstats
path: root/Doc/library/collections.rst
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-07-18 14:28:26 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-07-18 14:28:26 (GMT)
commit7a502de6f809f1ecb110bd84ffda94dd852f53ed (patch)
tree6934121e8fb14bda0a46350297e3aa5a8efc14b5 /Doc/library/collections.rst
parent721e9aa425b9603a630f38694e8cfae15e4420bb (diff)
downloadcpython-7a502de6f809f1ecb110bd84ffda94dd852f53ed.zip
cpython-7a502de6f809f1ecb110bd84ffda94dd852f53ed.tar.gz
cpython-7a502de6f809f1ecb110bd84ffda94dd852f53ed.tar.bz2
Merged revisions 82952,82954 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82952 | benjamin.peterson | 2010-07-18 09:23:36 -0500 (Sun, 18 Jul 2010) | 1 line use classmethod ........ r82954 | benjamin.peterson | 2010-07-18 09:27:02 -0500 (Sun, 18 Jul 2010) | 1 line nest method and attribute doc ........
Diffstat (limited to 'Doc/library/collections.rst')
-rw-r--r--Doc/library/collections.rst33
1 files changed, 17 insertions, 16 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index b19af9c..29504e0 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -527,7 +527,7 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
:class:`defaultdict` objects support the following method in addition to the
standard :class:`dict` operations:
- .. method:: defaultdict.__missing__(key)
+ .. method:: __missing__(key)
If the :attr:`default_factory` attribute is ``None``, this raises a
:exc:`KeyError` exception with the *key* as argument.
@@ -547,7 +547,7 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
:class:`defaultdict` objects support the following instance variable:
- .. attribute:: defaultdict.default_factory
+ .. attribute:: default_factory
This attribute is used by the :meth:`__missing__` method; it is
initialized from the first argument to the constructor, if present, or to
@@ -736,7 +736,7 @@ In addition to the methods inherited from tuples, named tuples support
three additional methods and one attribute. To prevent conflicts with
field names, the method and attribute names start with an underscore.
-.. method:: somenamedtuple._make(iterable)
+.. classmethod:: somenamedtuple._make(iterable)
Class method that makes a new instance from an existing sequence or iterable.
@@ -864,11 +864,11 @@ the items are returned in the order their keys were first added.
.. versionadded:: 3.1
-.. method:: OrderedDict.popitem(last=True)
+ .. method:: popitem(last=True)
- The :meth:`popitem` method for ordered dictionaries returns and removes
- a (key, value) pair. The pairs are returned in LIFO order if *last* is
- true or FIFO order if false.
+ The :meth:`popitem` method for ordered dictionaries returns and removes a
+ (key, value) pair. The pairs are returned in LIFO order if *last* is true
+ or FIFO order if false.
In addition to the usual mapping methods, ordered dictionaries also support
reverse iteration using :func:`reversed`.
@@ -929,12 +929,13 @@ attribute.
initialized with its contents; note that a reference to *initialdata* will not
be kept, allowing it be used for other purposes.
-In addition to supporting the methods and operations of mappings,
-:class:`UserDict` instances provide the following attribute:
+ In addition to supporting the methods and operations of mappings,
+ :class:`UserDict` instances provide the following attribute:
-.. attribute:: UserDict.data
+ .. attribute:: data
- A real dictionary used to store the contents of the :class:`UserDict` class.
+ A real dictionary used to store the contents of the :class:`UserDict`
+ class.
@@ -958,13 +959,13 @@ to work with because the underlying list is accessible as an attribute.
defaulting to the empty list ``[]``. *list* can be any iterable, for
example a real Python list or a :class:`UserList` object.
-In addition to supporting the methods and operations of mutable sequences,
-:class:`UserList` instances provide the following attribute:
+ In addition to supporting the methods and operations of mutable sequences,
+ :class:`UserList` instances provide the following attribute:
-.. attribute:: UserList.data
+ .. attribute:: data
- A real :class:`list` object used to store the contents of the
- :class:`UserList` class.
+ A real :class:`list` object used to store the contents of the
+ :class:`UserList` class.
**Subclassing requirements:** Subclasses of :class:`UserList` are expect to
offer a constructor which can be called with either no arguments or one