Patch by Paul Sokolovsky to support the get() method.

This commit is contained in:
Guido van Rossum 1999-08-11 01:54:05 +00:00
parent 50765abb29
commit 2f7df12f33
1 changed files with 5 additions and 0 deletions

View File

@ -60,6 +60,11 @@ def __len__(self):
def has_key(self, key):
return self.dict.has_key(key)
def get(self, key, default=None):
if self.dict.has_key(key):
return self[key]
return default
def __getitem__(self, key):
f = StringIO(self.dict[key])
return Unpickler(f).load()