Example #1
0
    def __eq__(self, other):
        """
        :param iterable other: A sequence of items.
        :returns: Whether this set is equal to the set of other.
        
        Examples:
        
        >>> assert SortedSet([1, 3, 2]) == [1, 2, 3]
        """

        return SetTree._ext_cmp(self, other, 2)
Example #2
0
    def isdisjoint(self, other):
        """
        Checks whether there are no common items in this set and other.
        
        :type other: iterable
        
        Examples:
        >>> assert SortedSet([1, 3, 2]).isdisjoint([42])
        """

        return SetTree._ext_cmp(self, other, 3)
Example #3
0
 def __eq__(self, other):
     """
     :param iterable other: A sequence of items.
     :returns: Whether this set is equal to the set of other.
     
     Examples:
     
     >>> assert SortedSet([1, 3, 2]) == [1, 2, 3]
     """
         
     return SetTree._ext_cmp(self, other, 2)
Example #4
0
 def isdisjoint(self, other):
     """
     Checks whether there are no common items in this set and other.
     
     :type other: iterable
     
     Examples:
     >>> assert SortedSet([1, 3, 2]).isdisjoint([42])
     """
     
     return SetTree._ext_cmp(self, other, 3)
Example #5
0
    def issubset(self, other):
        """
        :param iterable other: A sequence of items.
        :returns: Whether this set is a subset of the set of other.
        
        Examples:
        
        >>> assert SortedSet([1, 3, 2]).issubset([1, 2, 3, 4])
        >>> assert SortedSet([1, 4, 3]).issubset([1, 4, 2, 3, 4])
        >>> assert not SortedSet([1, 3, 2]).issubset([])
        >>> assert SortedSet([1, 2, 3]).issubset([1, 2, 3])        
        >>> assert SortedSet([1, 2, 3]) <= [1, 2, 3, 4]
        >>> assert SortedSet([1, 2, 3]) <= [1, 4, 3, 2]
        """

        return SetTree._ext_cmp(self, other, 0)
Example #6
0
 def issuperset(self, other):
     """
     :param iterable other: A sequence of items.
     :returns: Whether this set is a superset of the set of other.
     
     Examples:
     
     >>> assert not SortedSet([1, 3, 2]).issuperset([1, 2, 3, 4])
     >>> assert not SortedSet([1, 4, 3]).issuperset([1, 4, 2, 3, 4])
     >>> assert SortedSet([1, 3, 2]).issuperset([])
     >>> assert SortedSet([1, 2, 3]).issuperset([1, 2, 3])        
     >>> assert not SortedSet([1, 2, 3]) >= [1, 2, 3, 4]
     >>> assert not SortedSet([1, 2, 3]) >= [1, 4, 3, 2]
     """
     
     return SetTree._ext_cmp(self, other, 1)