- I am sorry, but any intellectual hippie pot smoking computer-science-PHd-whatever that gets the urge to reinvent the for-loop is retarded & stoned out. IMO.
The whole range business makes a lot more sense if you think about it from the perspective of Mathcad, Matlab, Mathematica, and tuples in general.
You create the range of elements over which you want to iterate.
Then you iterate.
It's simply a different syntax, which if you've never seen before, is annoying and makes you go WTF???? as the OP is doing. He's not wrong for doing that, he just hasn't had the "ah ha!" moment where it makes sense why, for certain solutions, it would make more sense to express the for loop this way. You simply specify an array of elements that you want to iterate data for. Our first assignment in python taught us this for graphing data sets, I think. So you think of it like x=1, x= 2, x=3, and I want the y values for these x guys, well what range of x values do I want graphed? range (-5, -1, -1).
Once you've memorized the parameters as "(start, stop, step)" it won't bother you as much.
Don't listen to esun, he's being a pedant. There's nothing wrong with preferring the for loop.
Hm, I wonder what the reasoning was for making the "stop" parameter exclusive not inclusive? -5 to -1 for stopping at 0 _is_ a bit confusing....