On 09/07/12 22:59, Abhishek Pratap wrote:
I want to know whether it is possible for dynamically update the step
size in xrange or someother slick way.
Here is what I am trying to do, if during a loop I find the x in list
I want to skip next #n iterations.
You could use the next() method of t
While you can't do it with a straight generator, you can create your own:
class MyIter:
def __init__(self, start, stop, step=1):
self.start = start
self.stop = stop
self.step = step
def __iter__(self):
self.cur = self.start
while self.cur < self.sto
Ok thanks Hugo. I have the while loop working
-A
On Mon, Jul 9, 2012 at 3:06 PM, Hugo Arts wrote:
> On Mon, Jul 9, 2012 at 11:59 PM, Abhishek Pratap
> wrote:
>>
>> hey guys
>>
>> I want to know whether it is possible for dynamically update the step
>> size in xrange or someother slick way.
>>
On Mon, Jul 9, 2012 at 11:59 PM, Abhishek Pratap wrote:
> hey guys
>
> I want to know whether it is possible for dynamically update the step
> size in xrange or someother slick way.
>
> Here is what I am trying to do, if during a loop I find the x in list
> I want to skip next #n iterations.
>
>
hey guys
I want to know whether it is possible for dynamically update the step
size in xrange or someother slick way.
Here is what I am trying to do, if during a loop I find the x in list
I want to skip next #n iterations.
for x in xrange(start,stop,step):
if x in list:
step = 14