As long as you're not saying indentation should replace curly braces, it's all good. =D
I hated Python for having no curly braces but now I fucking love it.Because if you're forced to use indentation (whether by the language itself or by "it's good practice" bullies), curly braces are completely unnecessary and a waste of two lines of visual space. I don't really see not being able to orient yourself in the code any less than when using curly braces.I also don't get your example:
Quote:
if (colour == red){print red;}else{print blue;}
The Python code for this would be exactly as long (4 lines), except with indentation instead of curly braces.And Python does allow you to put a number of operations in one line IIRC (not sure about if statements). It's just that nobody does it because it looks bad.
But curly braces do help me visualize stuff (particularly with editors brace highlighting/jump to end/etc), especially when you didn't write the code, and the code is very long and complex with a lot of nesting (my job is Quality Assurance, so I look through code). It just makes things much more contained, for me, and minimizes the chance of mistakes.
Yes. That is for small statements that don't hold much weight when analyzing code. Such as being used to catch things like:
if (number < minimum){number = minimum;}I'm not saying do things likeYeah, that was a really bad example.
But curly braces do help me visualize stuff (particularly with editors brace highlighting/jump to end/etc), especially when you didn't write the code, and the code is very long and complex with a lot of nesting (my job is Quality Assurance, so I look through code). It just makes things much more contained, for me, and minimizes the chance of mistakes.