diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-05-22 20:25:41 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-05-22 20:25:41 (GMT) |
commit | 1cf48b4adc0589dd52d123ddb6e5976c40ed2da5 (patch) | |
tree | d5b3b9740a690f1130f907f90520110d73f75317 /Lib/_weakrefset.py | |
parent | 54f70923a3a50971e726b62e63250ec05df21be4 (diff) | |
download | cpython-1cf48b4adc0589dd52d123ddb6e5976c40ed2da5.zip cpython-1cf48b4adc0589dd52d123ddb6e5976c40ed2da5.tar.gz cpython-1cf48b4adc0589dd52d123ddb6e5976c40ed2da5.tar.bz2 |
implement missing inequality on WeakSet
Diffstat (limited to 'Lib/_weakrefset.py')
-rw-r--r-- | Lib/_weakrefset.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/_weakrefset.py b/Lib/_weakrefset.py index 43f9a6e..990c3a6 100644 --- a/Lib/_weakrefset.py +++ b/Lib/_weakrefset.py @@ -171,6 +171,12 @@ class WeakSet(object): return NotImplemented return self.data == set(ref(item) for item in other) + def __ne__(self, other): + opposite = self.__eq__(other) + if opposite is NotImplemented: + return NotImplemented + return not opposite + def symmetric_difference(self, other): newset = self.copy() newset.symmetric_difference_update(other) |