]> granicus.if.org Git - python/commitdiff
Describe {}.popitem().
authorGuido van Rossum <guido@python.org>
Tue, 12 Dec 2000 22:10:31 +0000 (22:10 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 12 Dec 2000 22:10:31 +0000 (22:10 +0000)
Misc/NEWS

index 2b1d7b8faf79ec1b5fff57f6c9a20e33e96b93dd..4bb2425dfc1f464a00155330a2aff0de91d33dc9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,13 @@ Core language, builtins, and interpreter
   fit in an int.  In 1.6 and earlier, a negative long formatted
   via %u raised an error if it was too big to fit in an int.
 
+- Dictionary objects have an odd new method, popitem().  This removes
+  an arbitrary item from the dictionary and returns it (in the form of
+  a (key, value) pair).  This can be useful for algorithms that use a
+  dictionary as a bag of "to do" items and repeatedly need to pick one
+  item.  Such algorithms normally end up running in quadratic time;
+  using popitem() they can usually be made to run in linear time.
+
 Windows changes
 
 - select module:  By default under Windows, a select() call