summaryrefslogtreecommitdiffstats
path: root/Lib/weakref.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-06-01 14:18:47 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-06-01 14:18:47 (GMT)
commit54f0222547b1e92cd018ef132307a6f793dc9505 (patch)
tree667480d89feb3f9c7ca44e4ffa7bf39e725c120d /Lib/weakref.py
parent9d5e4aa4149edb92f6d28c9390d776ae4a1d719a (diff)
downloadcpython-54f0222547b1e92cd018ef132307a6f793dc9505.zip
cpython-54f0222547b1e92cd018ef132307a6f793dc9505.tar.gz
cpython-54f0222547b1e92cd018ef132307a6f793dc9505.tar.bz2
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 967458d..70d36fa 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():