(self, other)
return Interval(start, end, left_open, right_open)
This function should only be used internally

        See Set._intersect for docstring
This function should only be used internally
This function should only be used internally
def _intersect(self, other):
        """
        This function should only be used internally

        See Set._intersect for docstring
        """
        # We only know how to intersect with other intervals
        if not other.is_Interval:
            return None
        # We can't intersect [0,3] with [x,6] -- we don't know if x>0 or x<0
        if not self._is_comparable(other):
            return None

        empty = False

        if self.start <= other.end and other.start <= self.end:
            # Get topology right.
            if self.start < other.start:
                start = other.start
                left_open = other.left_open
            elif self.start > other.start:
                start = self.start
                left_open = self.left_open
            else:
                start = self.start
                left_open = self.left_open or other.left_open

            if self.end < other.end:
                end = self.end
                right_open = self.right_open
            elif self.end > other.end:
                end = other.end
                right_open = other.right_open
            else:
                end = self.end
                right_open = self.right_open or other.right_open

            if end - start == 0 and (left_open or right_open):
                empty = True
        else:
            empty = True

        if empty:
            return S.EmptySet

        return Interval(start, end, left_open, right_open)
def _intersect ( self , other ) : # We only know how to intersect with other intervals if not other . is_Interval : return None # We can't intersect [0,3] with [x,6] -- we don't know if x>0 or x<0 if not self . _is_comparable ( other ) : return None empty = False if self . start <= other . end and other . start <= self . end : # Get topology right. if self . start < other . start : start = other . start left_open = other . left_open elif self . start > other . start : start = self . start left_open = self . left_open else : start = self . start left_open = self . left_open or other . left_open if self . end < other . end : end = self . end right_open = self . right_open elif self . end > other . end : end = other . end right_open = other . right_open else : end = self . end right_open = self . right_open or other . right_open if end - start == 0 and ( left_open or right_open ) : empty = True else : empty = True if empty : return S . EmptySet return Interval ( start , end , left_open , right_open )