Was just wondering what\'s the most efficient way of generating all the circular shifts of a list in Python. In either direction. For example, given a list [1, 2, 3, 4
[1, 2, 3, 4
Using itertools to avoid indexing:
x = itertools.cycle(a) [[x.next() for i in a] for j in a]