diff options
author | Fred Drake <fdrake@acm.org> | 2001-05-03 04:55:47 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-05-03 04:55:47 (GMT) |
commit | a7cc69e02ef9ec7014600911a66978898e545cf1 (patch) | |
tree | 9025b57643391b34b3a46f630e2100ee9d9ee0a2 | |
parent | bedebbdfb1b0f7d8815426dc5a9d761033c731cd (diff) | |
download | cpython-a7cc69e02ef9ec7014600911a66978898e545cf1.zip cpython-a7cc69e02ef9ec7014600911a66978898e545cf1.tar.gz cpython-a7cc69e02ef9ec7014600911a66978898e545cf1.tar.bz2 |
Added support for .__contains__(), .__iter__(), .iterkeys().
-rw-r--r-- | Lib/dumbdbm.py | 9 |
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) |