summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-03-19 19:59:58 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-03-19 19:59:58 (GMT)
commit2412299be96bf590b46d7b0784cdb620170a8d7a (patch)
treefb440a9fef80b259b8866a314b4d447ccd4e0619 /Doc
parenta0b8d9ad2da71658ce20448bbb3f081bcd39f446 (diff)
downloadcpython-2412299be96bf590b46d7b0784cdb620170a8d7a.zip
cpython-2412299be96bf590b46d7b0784cdb620170a8d7a.tar.gz
cpython-2412299be96bf590b46d7b0784cdb620170a8d7a.tar.bz2
* Add clearer comment to initialization code.
* Add optional argument to popitem() -- modeled after Anthon van der Neut's C version. * Fix method markup in docs.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/collections.rst12
1 files changed, 10 insertions, 2 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index d6d1b68..32375a2 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -858,8 +858,11 @@ the items are returned in the order their keys were first added.
.. versionadded:: 2.7
-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())``.
@@ -867,3 +870,8 @@ Equality tests between :class:`OrderedDict` objects and other
:class:`Mapping` objects are order-insensitive like regular dictionaries.
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.