

def first_last(idx, seq):
    'Generate ``first`` or ``last`` or both, according to the\n    position `idx` in sequence `seq`.\n    '
    return classes(first=(idx == 0), last=(idx == (len(seq) - 1)))

dataset/ETHPy150Open edgewall/trac/trac/util/presentation.py first_last/original