mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Forward port r70470 and r70473 for OrderedDict to use a doubly linked list.
This commit is contained in:
parent
6cf17aacbf
commit
dc879f033c
3 changed files with 44 additions and 17 deletions
|
@ -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
|
||||
-------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue