def __optimize(self):

        """
        Merge overlapping or contacting subranges from ``self.__has`` attribute and update it. Called from all methods
        that modify object contents.

        Returns
        -------
        None
            Method does not return. It does internal modifications on ``self.__has`` attribute.
        """

        ret = []

        for (begin, end) in sorted(self.__has):

            if ret and begin <= end < ret[-1][1]: # when current range overlaps with the last one from ret
                ret[-1] = (ret[-1][0], end)
            elif not ret or begin > ret[-1][1]:
                ret.append( (begin, end) )

        self.__has = set(ret)
dataset/ETHPy150Open rasguanabana/ytfs/ytfs/range_t.py/range_t.__optimize/swapped operands of `<`