]> granicus.if.org Git - python/commitdiff
The previous change works much faster (one lookup per key) when
authorRaymond Hettinger <python@rcn.com>
Sat, 13 Sep 2003 03:18:34 +0000 (03:18 +0000)
committerRaymond Hettinger <python@rcn.com>
Sat, 13 Sep 2003 03:18:34 +0000 (03:18 +0000)
iteritems() is defined.

Lib/bsddb/__init__.py

index 5fc8a38508ee3a1afffaeff4732b369e50b7e1c3..2910236b3d7441e272322350e9fad92c58fe35ae 100644 (file)
@@ -154,6 +154,15 @@ class _DBWithCursor(UserDict.DictMixin):
         except _bsddb.DBNotFoundError:
             return
 
+    def iteritems(self):
+        try:
+            yield self.first()
+            next = self.next
+            while 1:
+                yield next()
+        except _bsddb.DBNotFoundError:
+            return
+
 #----------------------------------------------------------------------
 # Compatibility object factory functions