summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/UserDict.py4
-rw-r--r--Lib/shelve.py6
2 files changed, 5 insertions, 5 deletions
diff --git a/Lib/UserDict.py b/Lib/UserDict.py
index a786ae0..39f4d07 100644
--- a/Lib/UserDict.py
+++ b/Lib/UserDict.py
@@ -41,7 +41,7 @@ class UserDict:
def iterkeys(self): return self.data.iterkeys()
def itervalues(self): return self.data.itervalues()
def values(self): return self.data.values()
- def has_key(self, key): return self.data.has_key(key)
+ def has_key(self, key): return key in self.data
def update(self, dict=None, **kwargs):
if dict is None:
pass
@@ -59,7 +59,7 @@ class UserDict:
return failobj
return self[key]
def setdefault(self, key, failobj=None):
- if not self.has_key(key):
+ if key not in self:
self[key] = failobj
return self[key]
def pop(self, key, *args):
diff --git a/Lib/shelve.py b/Lib/shelve.py
index 7a75445..f1a468e 100644
--- a/Lib/shelve.py
+++ b/Lib/shelve.py
@@ -95,13 +95,13 @@ class Shelf(UserDict.DictMixin):
return len(self.dict)
def has_key(self, key):
- return self.dict.has_key(key)
+ return key in self.dict
def __contains__(self, key):
- return self.dict.has_key(key)
+ return key in self.dict
def get(self, key, default=None):
- if self.dict.has_key(key):
+ if key in self.dict:
return self[key]
return default