From: ggarramuno@... (GGarramuno) Date: 2004-01-22T05:59:58+09:00 Subject: Re: New to Python: my impression v. Perl/Ruby for i in (0..i); something; end to me has a bunch of advantages over times, step and the such. With the above construct you know that: a) i has to be a number b) i has to be positive for the loop to run c) there IS a loop after all, as 'for' indicates a loop in pretty much every computer language. d) it is more efficient as no blocks are created. e) you can change the starting point (ie. not start at 0). With i.times() I really don't get any of the above. One can asume that i.times means a loop as it is perhaps a common construct in ruby. But the truth is that i.times() also leaves room for that behavior to not be true. It could mean something else, too. It could be a fancy benchmarking object measuring the following block. Or any object with a times() method, for that matter. Pre-assuming it is a loop to me is not as obvious as with a for loop. And you always get the performance hit of opening a block, which is a big no-no to me when speed matters. Iterating with each is a much nicer way and it indeed removes the need for many for/loops as they appear in C. But it only is helpful when you are dealing with some form of enumerable collection (arrays, hashes, etc). It also suffers from the block performance hit, but likely that is compensated by not having to do sth. like a[idx], and being able to rely on a.succ. Still, the each construct does not help you for numeric algorithms such as that from the original poster, where no collection is available (where you are indeed just counting numbers).