From: Joe Mason Date: 2004-01-22T19:50:12+09:00 Subject: Re: New to Python: my impression v. Perl/Ruby In article <20040121155809.22006.00000323@mb-m22.aol.com>, GGarramuno wrote: > > 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. So, what you're saying is, you don't want to use Ruby's features because the same names could be used in other ways. That's a fair reason to not use Ruby, I suppose. Feel free not to. But you're not going to convince anyone else with that argument. Joe