mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #14195: Make WeakSet.__lt__ and WeakSet.__gt__ irreflexive.
This commit is contained in:
parent
94c2d6df54
commit
104f18977f
3 changed files with 33 additions and 17 deletions
|
@ -154,17 +154,17 @@ class WeakSet(object):
|
|||
|
||||
def issubset(self, other):
|
||||
return self.data.issubset(ref(item) for item in other)
|
||||
__lt__ = issubset
|
||||
__le__ = issubset
|
||||
|
||||
def __le__(self, other):
|
||||
return self.data <= set(ref(item) for item in other)
|
||||
def __lt__(self, other):
|
||||
return self.data < set(ref(item) for item in other)
|
||||
|
||||
def issuperset(self, other):
|
||||
return self.data.issuperset(ref(item) for item in other)
|
||||
__gt__ = issuperset
|
||||
__ge__ = issuperset
|
||||
|
||||
def __ge__(self, other):
|
||||
return self.data >= set(ref(item) for item in other)
|
||||
def __gt__(self, other):
|
||||
return self.data > set(ref(item) for item in other)
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, self.__class__):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue