Re: [Tutor] Alternating patterns

2006-03-29 Thread Kent Johnson
kevin parks wrote: >>From: Kent Johnson <[EMAIL PROTECTED]> >>itertools.cycle() will repeat a sequence indefinitely: >>In [2]: from itertools import cycle >> >>In [3]: i=cycle([1,2]) >> >>In [5]: for j in range(6): >>...: print i.next() >>...: >>...: >>1 >>2 >>1 >>2 >>1 >>2 >> >>For

Re: [Tutor] Alternating patterns

2006-03-28 Thread Pujo Aji
8 -0500> From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Alternating patterns> Cc: tutor@python.org> Message-ID: <[EMAIL PROTECTED]>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >> kevin parks wrote:>> I have a set that i iterate over..

Re: [Tutor] Alternating patterns

2006-03-28 Thread kevin parks
> > > > -- > > Message: 10 > Date: Tue, 28 Mar 2006 22:43:38 -0500 > From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Alternating patterns > Cc: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Typ

Re: [Tutor] Alternating patterns

2006-03-28 Thread Kent Johnson
kevin parks wrote: > I have a set that i iterate over... but each time through it i would > like to alternate between the original set and a variation of the set > that has one of the members of the set altered (by + or - 1) > > So if my original set is: > > [0, 2, 4, 5, 7, 9, 11] > > I would