mirror of https://github.com/python/cpython
The previous change works much faster (one lookup per key) when
iteritems() is defined.
This commit is contained in:
parent
91dd19db6f
commit
2e9da6020e
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue