diff options
| author | Raymond Hettinger <python@rcn.com> | 2009-03-19 20:30:56 +0000 |
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2009-03-19 20:30:56 +0000 |
| commit | dc879f033c9a1fd15e27f7bac2a46d38ca19e8c5 (patch) | |
| tree | cc2961e67f2e7346aad00ce35308df4eb29ad2a8 /Doc/library | |
| parent | 6cf17aacbfd08aab5edc73c758647536c1576601 (diff) | |
| download | cpython-git-dc879f033c9a1fd15e27f7bac2a46d38ca19e8c5.tar.gz | |
Forward port r70470 and r70473 for OrderedDict to use a doubly linked list.
Diffstat (limited to 'Doc/library')
| -rw-r--r-- | Doc/library/collections.rst | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index 1a23fca31d..b136cf1504 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -836,8 +836,11 @@ the items are returned in the order their keys were first added. .. versionadded:: 3.1 -The :meth:`popitem` method for ordered dictionaries returns and removes the -last added entry. The key/value pairs are returned in LIFO order. +.. method:: OrderedDict.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. Equality tests between :class:`OrderedDict` objects are order-sensitive and are implemented as ``list(od1.items())==list(od2.items())``. @@ -846,6 +849,11 @@ Equality tests between :class:`OrderedDict` objects and other This allows :class:`OrderedDict` objects to be substituted anywhere a regular dictionary is used. +.. seealso:: + + `Equivalent OrderedDict recipe <http://code.activestate.com/recipes/576693/>`_ + that runs on Python 2.4 or later. + :class:`UserDict` objects ------------------------- |
