summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pylru.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pylru.py b/pylru.py
index e69cadb..fd44f97 100644
--- a/pylru.py
+++ b/pylru.py
@@ -101,10 +101,10 @@ class lrucache(object):
def get(self, key, default=None):
"""Get an item - return default (None) if not present"""
- try:
- return self[key]
- except KeyError:
+ if key not in self.table:
return default
+
+ return self[key]
def __setitem__(self, key, value):
# First, see if any value is stored under 'key' in the cache already.