npstreams.
cyclic
Yields cyclic permutations of an iterable.
Examples
>>> list(cyclic((1,2,3))) [(1,2,3), (2,3,1), (3,1,2)]