Kaydet (Commit) a7cc69e0 authored tarafından Fred Drake's avatar Fred Drake

Added support for .__contains__(), .__iter__(), .iterkeys().

üst bedebbdf
......@@ -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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment