summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/shelve.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/shelve.py b/Lib/shelve.py
index e617e89..807a0bb 100644
--- a/Lib/shelve.py
+++ b/Lib/shelve.py
@@ -59,6 +59,11 @@ class Shelf:
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])