The previous change works much faster (one lookup per key) when

iteritems() is defined.
This commit is contained in:
Raymond Hettinger 2003-09-13 03:18:34 +00:00
parent 91dd19db6f
commit 2e9da6020e
1 changed files with 9 additions and 0 deletions

View 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