def compareLists(list1, list2):
    """returns the union and the disjoint members of two lists.

    .. note:: Deprecated
        Use python sets instead.

    Returns
    -------
    unique1 : set
        Elements unique in set1
    unique2 : set
        Elements unique in set2
    common: set
        Elements in both lists.

    """

    unique1 = []
    unique2 = []
    common = []

    set1 = sorted(list1)
    set2 = sorted(list2)

    x1 = 0
    x2 = 0
    while 1:

        if x1 >= len(set1) or x2 >= len(set2):
            break

        if set2[x2] == set1[x1]:
            common.append(set1[x1])
            x1 += 1
            x2 += 1
            continue

        if set1[x1] < set2[x2]:
            unique1.append(set1[x1])
            x1 += 1
            continue

        if set1[x1] > set2[x2]:
            unique2.append(set2[x2])
            x2 += 1

    if len(set2) < x2:
        unique2 += set2[x2:]
    elif x1 < len(set1):
        unique1 += set1[x1:]

    return unique1, unique2, common
dataset/ETHPy150Open CGATOxford/cgat/CGAT/SetTools.py/compareLists/swapped operands of `<`