summaryrefslogtreecommitdiff
path: root/Lib/weakref.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-06-01 14:18:47 +0000
committerRaymond Hettinger <python@rcn.com>2002-06-01 14:18:47 +0000
commit73a2a7244e024f1876ae5ba69109b82fa30b2d22 (patch)
tree9433e3e2c56fa3f4c3cb24caa2dd8563345d3c52 /Lib/weakref.py
parent57f39f3bd34a7547ed8305cfb6cd1941b7530d7f (diff)
downloadcpython-73a2a7244e024f1876ae5ba69109b82fa30b2d22.tar.gz
SF 563203. Replaced 'has_key()' with 'in'.
Diffstat (limited to 'Lib/weakref.py')
-rw-r--r--Lib/weakref.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/weakref.py b/Lib/weakref.py
index 967458d989..70d36fa3b9 100644
--- a/Lib/weakref.py
+++ b/Lib/weakref.py
@@ -183,8 +183,15 @@ class WeakKeyDictionary(UserDict.UserDict):
wr = ref(key)
except TypeError:
return 0
- return self.data.has_key(wr)
+ return wr in self.data
+ def __contains__(self, key):
+ try:
+ wr = ref(key)
+ except TypeError:
+ return 0
+ return wr in self.data
+
def items(self):
L = []
for key, value in self.data.items():