Commit d319ad5c authored by Benjamin Peterson's avatar Benjamin Peterson

nest method and attribute doc

parent 0b9fb808
...@@ -551,7 +551,7 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``, ...@@ -551,7 +551,7 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
:class:`defaultdict` objects support the following method in addition to the :class:`defaultdict` objects support the following method in addition to the
standard :class:`dict` operations: standard :class:`dict` operations:
.. method:: defaultdict.__missing__(key) .. method:: __missing__(key)
If the :attr:`default_factory` attribute is ``None``, this raises a If the :attr:`default_factory` attribute is ``None``, this raises a
:exc:`KeyError` exception with the *key* as argument. :exc:`KeyError` exception with the *key* as argument.
...@@ -571,7 +571,7 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``, ...@@ -571,7 +571,7 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
:class:`defaultdict` objects support the following instance variable: :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 This attribute is used by the :meth:`__missing__` method; it is
initialized from the first argument to the constructor, if present, or to initialized from the first argument to the constructor, if present, or to
...@@ -891,11 +891,11 @@ the items are returned in the order their keys were first added. ...@@ -891,11 +891,11 @@ the items are returned in the order their keys were first added.
.. versionadded:: 3.1 .. versionadded:: 3.1
.. method:: OrderedDict.popitem(last=True) .. method:: popitem(last=True)
The :meth:`popitem` method for ordered dictionaries returns and removes The :meth:`popitem` method for ordered dictionaries returns and removes a
a (key, value) pair. The pairs are returned in LIFO order if *last* is (key, value) pair. The pairs are returned in LIFO order if *last* is true
true or FIFO order if false. or FIFO order if false.
In addition to the usual mapping methods, ordered dictionaries also support In addition to the usual mapping methods, ordered dictionaries also support
reverse iteration using :func:`reversed`. reverse iteration using :func:`reversed`.
...@@ -956,12 +956,13 @@ attribute. ...@@ -956,12 +956,13 @@ attribute.
initialized with its contents; note that a reference to *initialdata* will not initialized with its contents; note that a reference to *initialdata* will not
be kept, allowing it be used for other purposes. be kept, allowing it be used for other purposes.
In addition to supporting the methods and operations of mappings, In addition to supporting the methods and operations of mappings,
:class:`UserDict` instances provide the following attribute: :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.
...@@ -985,13 +986,13 @@ to work with because the underlying list is accessible as an attribute. ...@@ -985,13 +986,13 @@ to work with because the underlying list is accessible as an attribute.
defaulting to the empty list ``[]``. *list* can be any iterable, for defaulting to the empty list ``[]``. *list* can be any iterable, for
example a real Python list or a :class:`UserList` object. example a real Python list or a :class:`UserList` object.
In addition to supporting the methods and operations of mutable sequences, In addition to supporting the methods and operations of mutable sequences,
:class:`UserList` instances provide the following attribute: :class:`UserList` instances provide the following attribute:
.. attribute:: UserList.data .. attribute:: data
A real :class:`list` object used to store the contents of the A real :class:`list` object used to store the contents of the
:class:`UserList` class. :class:`UserList` class.
**Subclassing requirements:** Subclasses of :class:`UserList` are expect to **Subclassing requirements:** Subclasses of :class:`UserList` are expect to
offer a constructor which can be called with either no arguments or one offer a constructor which can be called with either no arguments or one
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment