def divide(iterable, parts):
    ''' Partitions an iterable into parts number of lists. '''
    items = list(iterable)

    seqs = [[] for _ in xrange(parts)]
    while items:
        for i in xrange(parts):
            if not items:
                break
        
            seqs[i].append(items.pop())
        
    return seqs
 Partitions an iterable into parts number of lists. 
recipes/Python/576785_Partitiiterable_inn/recipe-576785.py