Beppe wrote: > hi all > > I've a tuple, something like > > x = ("A","B","C","D","E","F","G","H",) > > I would want to iterate on all tuple's elements > starting from a specific index
> with the difference that I would want to restart from the beginning when I > reach the end of the tupla > > > C > D > E > F > G > H > A > B > > I would want to make a circular iteration.... > > suggestions? As an alternative to the options mentioned by Ian you can use a deque instead of the tuple: >>> from collections import deque >>> d = deque("ABCDEFGH") >>> d.rotate(-2) >>> print(*d) C D E F G H A B -- https://mail.python.org/mailman/listinfo/python-list