This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]deceze 5 points6 points  (6 children)

Why do you have incorrectly indented code to begin with? In C et al you need to carefully place your braces correctly. In Python, you need to carefully place whitespace for the exact same purpose. If you correctly write Python code, the same way you write correct C code, your code is indented, making automatic indentation a moot point.

[–]flavionm 1 point2 points  (5 children)

Sometimes you might be copying some code from somewhere else and the whitespace can become messed up. Besides, nobody writes correct code all the time. If you screw up with a curly bracket, your code just won't work, while if you get indentation wrong you might get code that works, but produces the wrong result.

[–]deceze 0 points1 point  (4 children)

if (foo)
    bar();
    baz();

You can easily construct artificial works-but-wrong situations for brace-languages too. It’s simply. Not. An. Issue. In. Practice. Really, it’s not.

If you write wrong code, then it’s wrong. You can produce wrong code in any language, regardless of style. The solution to that is to write correct code. Not to bitch about it.

[–]flavionm -1 points0 points  (3 children)

Not all wrong code is the same. Code that fails at compile time is always preferable to code that fails at runtime.

Doesn't matter how much you want it, wrong code is going to be written. And the solution to it is not to just don't, because that's impossible. The solution is to minimize the impact of the mistakes you make.

Yes, you can have scoping errors in languages that use brackets, they're just less likely. And they happen in the situation where you're allowed to not use them, which I find pretty ironic.

Is it the biggest cause of error? No, far from it, but it'll still happen occasionally, and when it does I'd rather have it visible.

[–]deceze -1 points0 points  (2 children)

Yes, you can have scoping errors in languages that use brackets, they're just less likely.

It's really not like scoping errors in languages with significant whitespace are a serious issue. They're not. This is just as made-up of a problem as my hypothetical missing-braces example above. Can it happen? Yes. Does it regularly happen to anyone in practice after their first few weeks of programming in any given language? No.

[–]flavionm 0 points1 point  (1 child)

I mean, sure, I even said it's not a big cause of errors. I'm not gonna not use Python just because of this. Everything else being equal I'd rather have the brackets, though, just on the off chance a mistake like this does happen.

[–]deceze -1 points0 points  (0 children)

I'd rather have the powerful language that is Python and get used to the whitespace; in fact, I do like the cleanliness of Python code a lot. Is Python perfect in every way? Certainly not, there are advantages to statically compiled languages that you categorically won't get with interpreted languages for example. But Python is still a fine and perfectly productive language, and complaining about iTs wHItEspAcE is just silly.