[Python-checkins] r65510 - python/trunk/Lib/shelve.py

brett.cannon python-checkins at python.org
Mon Aug 4 23:17:15 CEST 2008


Author: brett.cannon
Date: Mon Aug  4 23:17:15 2008
New Revision: 65510

Log:
Remove dict.has_key() usage in the shelve module to silence warnings under -3.


Modified:
   python/trunk/Lib/shelve.py

Modified: python/trunk/Lib/shelve.py
==============================================================================
--- python/trunk/Lib/shelve.py	(original)
+++ python/trunk/Lib/shelve.py	Mon Aug  4 23:17:15 2008
@@ -105,13 +105,13 @@
         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
 


More information about the Python-checkins mailing list