- Oct 10, 2006
- 21,568
- 3
- 0
So I have to learn python for a class, and it's a decent language insofar, just encountered the first thing that makes my skin crawl: retarded for-loops (oh sorry, for "statements") Now granted I'm coming from 8 years of C/C++ and Java, but come on. If I want to make a for loop that goes from 5 to zero inclusive I have to use:
for i in range(5, -1, -1)
That's two negative numbers and a function, all to say I want to count from 5 to 0.
Contrast to:
for(int i = 5; i >= 0; i--)
Nice and explicit. You have the variable and its initial value, the explicit limit of the variable without having to look up weather "range" or some other function is inclusive or not, followed by the interval of the variable.
Don't tell this to my recent PhD professor though. He keeps expounding on how ugly and dirty everything c++ is. Because obviously the last thing anyone wants in code is detail /rant
for i in range(5, -1, -1)
That's two negative numbers and a function, all to say I want to count from 5 to 0.
Contrast to:
for(int i = 5; i >= 0; i--)
Nice and explicit. You have the variable and its initial value, the explicit limit of the variable without having to look up weather "range" or some other function is inclusive or not, followed by the interval of the variable.
Don't tell this to my recent PhD professor though. He keeps expounding on how ugly and dirty everything c++ is. Because obviously the last thing anyone wants in code is detail /rant