summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-05-03 04:55:47 (GMT)
committerFred Drake <fdrake@acm.org>2001-05-03 04:55:47 (GMT)
commita7cc69e02ef9ec7014600911a66978898e545cf1 (patch)
tree9025b57643391b34b3a46f630e2100ee9d9ee0a2
parentbedebbdfb1b0f7d8815426dc5a9d761033c731cd (diff)
downloadcpython-a7cc69e02ef9ec7014600911a66978898e545cf1.zip
cpython-a7cc69e02ef9ec7014600911a66978898e545cf1.tar.gz
cpython-a7cc69e02ef9ec7014600911a66978898e545cf1.tar.bz2
Added support for .__contains__(), .__iter__(), .iterkeys().
-rw-r--r--Lib/dumbdbm.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/dumbdbm.py b/Lib/dumbdbm.py
index f1cc41b..30ec114 100644
--- a/Lib/dumbdbm.py
+++ b/Lib/dumbdbm.py
@@ -135,6 +135,13 @@ class _Database:
def has_key(self, key):
return self._index.has_key(key)
+ def __contains__(self, key):
+ return self._index.has_key(key)
+
+ def iterkeys(self):
+ return self._index.iterkeys()
+ __iter__ = iterkeys
+
def __len__(self):
return len(self._index)
@@ -143,6 +150,6 @@ class _Database:
self._datfile = self._dirfile = self._bakfile = None
-def open(file, flag = None, mode = None):
+def open(file, flag=None, mode=None):
# flag, mode arguments are currently ignored
return _Database(file)