diff options
author | Raymond Hettinger <python@rcn.com> | 2003-09-13 03:18:34 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-09-13 03:18:34 (GMT) |
commit | 2e9da6020e67e9dde38deb7b56baab7eabb0a808 (patch) | |
tree | 4dc43ba46ab268d758c4292fc1238ee8b52d52e8 /Lib | |
parent | 91dd19db6fe426c52a30843ab2b5bc8776c8c414 (diff) | |
download | cpython-2e9da6020e67e9dde38deb7b56baab7eabb0a808.zip cpython-2e9da6020e67e9dde38deb7b56baab7eabb0a808.tar.gz cpython-2e9da6020e67e9dde38deb7b56baab7eabb0a808.tar.bz2 |
The previous change works much faster (one lookup per key) when
iteritems() is defined.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/bsddb/__init__.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py index 5fc8a38..2910236 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 |