Hi there,

I am quite new to Python, and have a straight & simple question.
In C, there is for (init; cond; advance). We all know that.
In Python there are two ways to loop over i=A..B (numerical.):
1) i = A
   while i<B:
      ...do something...
      i+=STEP
2) for i in range(A, B, STEP):
     ...do something...

First case looks quite nasty, because it's for more complicated
things, not numerical loops. Second is very nice, but with there's
problem. If i do ..in range(1, 100000000).. (what I really need
sometimes), it takes few hundred megs of memory and slows
down. Are there other good ways for this simple problem? Generators?

Adomas

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

Reply via email to