From: Raymond Hettinger Date: Sat, 13 Sep 2003 03:18:34 +0000 (+0000) Subject: The previous change works much faster (one lookup per key) when X-Git-Tag: v2.4a1~1581 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2e9da6020e67e9dde38deb7b56baab7eabb0a808;p=thirdparty%2FPython%2Fcpython.git The previous change works much faster (one lookup per key) when iteritems() is defined. --- diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py index 5fc8a38508ee..2910236b3d74 100644 --- a/Lib/bsddb/__init__.py +++ b/Lib/bsddb/__init__.py @@ -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