diff options
author | Raymond Hettinger <python@rcn.com> | 2002-06-01 14:18:47 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2002-06-01 14:18:47 +0000 |
commit | 73a2a7244e024f1876ae5ba69109b82fa30b2d22 (patch) | |
tree | 9433e3e2c56fa3f4c3cb24caa2dd8563345d3c52 /Lib/weakref.py | |
parent | 57f39f3bd34a7547ed8305cfb6cd1941b7530d7f (diff) | |
download | cpython-73a2a7244e024f1876ae5ba69109b82fa30b2d22.tar.gz |
SF 563203. Replaced 'has_key()' with 'in'.
Diffstat (limited to 'Lib/weakref.py')
-rw-r--r-- | Lib/weakref.py | 9 |
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(): |