Hi Beppe !

There are some powerful tools in the standard *itertools* module, you should have a look at it :)
https://docs.python.org/3/library/itertools.html

This is what I would do to cycle over you iterable without making several copies of it.

```
from itertools import islice, chain

def cycle_once(iterable, start):
    return chain(islice(iterable, start, None), islice(iterable, start))

my_iterable = ('A','B','C','D','E','F','G','H')

for e in cycle_once(my_iterable, 2):
    print(i)
```

Ps: I am pretty new to how a mailing list works. If I answered the wrong way, do not hesitate to tell me :)
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to