]> granicus.if.org Git - python/commitdiff
Fill-in missing Set comparisons
authorRaymond Hettinger <python@rcn.com>
Fri, 8 Feb 2008 23:34:21 +0000 (23:34 +0000)
committerRaymond Hettinger <python@rcn.com>
Fri, 8 Feb 2008 23:34:21 +0000 (23:34 +0000)
Lib/_abcoll.py

index 30ec7d4280cd01791141ba89905bd0295bd08b4d..4009ccb591706ad3f244f4c646ba101a5478c1ce 100644 (file)
@@ -163,11 +163,24 @@ class Set:
             return NotImplemented
         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):
         if not isinstance(other, Set):
             return NotImplemented
         return len(self) == len(other) and self.__le__(other)
 
+    def __ne__(self, other):
+        return not (self == other)
+
     @classmethod
     def _from_iterable(cls, it):
         '''Construct an instance of the class from any iterable input.