Example #1
0
    def __xor__(self, other):
        """
        :param iterable other: Other items.
        :returns: The symmetric difference of the items in this set and those in other. 
        
        Example:
        
        >>> SortedSet([1, 3, 2]) ^ [3, 1, 5]
        SortedSet([2, 5])
        """

        return self.__class__(SetTree._ext_union(self, other,
                                                 3), self._init_info.key_type,
                              self._init_info.alg, self._init_info.key,
                              self._init_info.compare, self._init_info.updator)
Example #2
0
    def __and__(self, other):
        """
        :param iterable other: Other items.
        :returns: The intersection of the items in this set and those in other. 
        
        Example:
        
        >>> SortedSet([1, 3, 2]) & [3, 1]
        SortedSet([1, 3])
        """

        return self.__class__(SetTree._ext_union(self, other,
                                                 1), self._init_info.key_type,
                              self._init_info.alg, self._init_info.key,
                              self._init_info.compare, self._init_info.updator)
Example #3
0
 def __xor__(self, other):
     """
     :param iterable other: Other items.
     :returns: The symmetric difference of the items in this set and those in other. 
     
     Example:
     
     >>> SortedSet([1, 3, 2]) ^ [3, 1, 5]
     SortedSet([2, 5])
     """
     
     return self.__class__(
         SetTree._ext_union(self, other, 3),
         self._init_info.key_type,
         self._init_info.alg,
         self._init_info.key,
         self._init_info.compare,
         self._init_info.updator)
Example #4
0
 def __and__(self, other):
     """
     :param iterable other: Other items.
     :returns: The intersection of the items in this set and those in other. 
     
     Example:
     
     >>> SortedSet([1, 3, 2]) & [3, 1]
     SortedSet([1, 3])
     """
     
     return self.__class__(
         SetTree._ext_union(self, other, 1),
         self._init_info.key_type,
         self._init_info.alg,
         self._init_info.key,
         self._init_info.compare,
         self._init_info.updator)