Kaydet (Commit) d53f1c4d authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Fill-in missing Set comparisons

üst 18a1ffcd
...@@ -163,11 +163,24 @@ class Set: ...@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment