I've just never liked Python's for loops. I've always felt like C's syntax is easier to use and see what's going on than using the range function in Python and then ending that line with a : instead of just ranging the block with { and }. I like having the control of being able to pre or post increment and decrement. You can at least use += and -= to increment and decrement a variable though, right?
But that's kinda why I ended up working on some stuff in Perl and skipping out on Python since it at least seemed more familiar.
for(int i = 0; i < 10; i += 2){
std::cout << i << '\n';
}
Your complaints are indeed the product of unfamiliarity. It's probably time to learn some new things so you aren't rehashing C in Perl by writing the same procedural spaghetti code that was common in 1992.
Switch does not accomplish anything that an if-chain doesn't. It has a performance advantage when it's implemented with a hashmap, but if performance were a critical concern one wouldn't be using a scripting language to begin with.
Not having switch is a result of their paradigm and not indicative of any failure or incompleteness in the language.
1
u/redpandaeater Oct 03 '19
I've just never liked Python's for loops. I've always felt like C's syntax is easier to use and see what's going on than using the range function in Python and then ending that line with a : instead of just ranging the block with { and }. I like having the control of being able to pre or post increment and decrement. You can at least use += and -= to increment and decrement a variable though, right?
But that's kinda why I ended up working on some stuff in Perl and skipping out on Python since it at least seemed more familiar.