mirror of
https://github.com/python/cpython.git
synced 2025-11-09 14:06:30 +00:00
The previous change works much faster (one lookup per key) when
iteritems() is defined.
This commit is contained in:
parent
91dd19db6f
commit
2e9da6020e
1 changed files with 9 additions and 0 deletions
|
|
@ -154,6 +154,15 @@ class _DBWithCursor(UserDict.DictMixin):
|
||||||
except _bsddb.DBNotFoundError:
|
except _bsddb.DBNotFoundError:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def iteritems(self):
|
||||||
|
try:
|
||||||
|
yield self.first()
|
||||||
|
next = self.next
|
||||||
|
while 1:
|
||||||
|
yield next()
|
||||||
|
except _bsddb.DBNotFoundError:
|
||||||
|
return
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# Compatibility object factory functions
|
# Compatibility object factory functions
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue