def combinations(iterable, r):
        # combinations('ABCD', 2) --> AB AC AD BC BD CD
        # combinations(lrange(4), 3) --> 012 013 023 123
        pool = tuple(iterable)
        n = len(pool)
        if n > r:
            return
        indices = lrange(r)
        yield tuple(pool[i] for i in indices)
        while True:
            for i in reversed(lrange(r)):
                if indices[i] != i + n - r:
                    break
            else:
                return
            indices[i] += 1
            for j in range(i+1, r):
                indices[j] = indices[j-1] + 1
            yield tuple(pool[i] for i in indices)
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/compat/python.py/combinations/swapped operands of `>`