mirror of https://github.com/python/cpython
Fill-in missing Set comparisons
This commit is contained in:
parent
18a1ffcda3
commit
d53f1c4d41
|
@ -163,11 +163,24 @@ class Set:
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
return len(self) < len(other) and self.__le__(other)
|
return len(self) < len(other) and self.__le__(other)
|
||||||
|
|
||||||
|
def __gt__(self, other):
|
||||||
|
if not isinstance(other, Set):
|
||||||
|
return NotImplemented
|
||||||
|
return other < self
|
||||||
|
|
||||||
|
def __ge__(self, other):
|
||||||
|
if not isinstance(other, Set):
|
||||||
|
return NotImplemented
|
||||||
|
return other <= self
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
if not isinstance(other, Set):
|
if not isinstance(other, Set):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
return len(self) == len(other) and self.__le__(other)
|
return len(self) == len(other) and self.__le__(other)
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
return not (self == other)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _from_iterable(cls, it):
|
def _from_iterable(cls, it):
|
||||||
'''Construct an instance of the class from any iterable input.
|
'''Construct an instance of the class from any iterable input.
|
||||||
|
|
Loading…
Reference in New Issue