Update more instances of has_key().
This commit is contained in:
parent
8982cf5484
commit
31ce5cb989
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue