"Mr.SpOOn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
On Sun, Sep 28, 2008 at 8:59 PM, Aaron Castironpi Brady
<[EMAIL PROTECTED]> wrote:

Here is a link to someone else's design they asked about on the
newsgroup a couple weeks ago.

http://groups.google.com/group/comp.lang.python/browse_thread/thread/ecffaa827984866d/921cba3084b984dc?lnk=st&q=sharpnote#921cba3084b984dc

:D
It's always me.

I think my question is more specific. I need some sort of cycle.

So if I have a list with A, B, C, D, when I iter over it I need to get
an A after the D.

Check out itertools.cycle:

x=itertools.cycle('ABCDEFG')
x.next()
'A'
x.next()
'B'
x.next()
'C'
x.next()
'D'
x.next()
'E'
x.next()
'F'
x.next()
'G'
x.next()
'A'
x.next()
'B'

-Mark

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to