def combinations(seq, r=None):
        if r == None:
            r = len(seq)
        if r <= 0:
            yield []
        else:
            for i in xrange(len(seq)):
                for cc in combinations(seq[i + 1:], r - 1):
                    yield [seq[i]] + cc
Add column for text label, based on level-oriented index.
dataset/ETHPy150Open muricoca/crab/scikits/crab/utils/extmath.py/combinations--crossover with--dataset/ETHPy150Open bokeh/bokeh/bokeh/charts/utils.py/add_text_label_from_index