Is there a nice Pythonic way to loop over a list, retuning a pair of elements? The last element should be paired with the first.
So for instance, if I have the list
There are more efficient ways (that don't built temporary lists), but I think this is the most concise:
> l = [1,2,3] > zip(l, (l+l)[1:]) [(1, 2), (2, 3), (3, 1)]