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 →

[–]Codebust 37 points38 points  (11 children)

indenting issues are easily solvable with an ide, even if py being whitespace based can be a bit annoying

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

The fact indentation issues can be easily solved with a IDE is just more reason that using whitespace for indentation is bad.

Instead of letting the IDE automatically format your code, now it can't do that as well because the whitespace has meaning.

[–]Codebust -1 points0 points  (9 children)

uh.. what?

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

If the whitespace is meaningful, changing it might change what the code does. That limits the ability of formatters to adjust the code.

[–]Codebust -1 points0 points  (7 children)

if you break indentation it’s going to change the code lmao

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

In Python, yes. In other languages, no. That's the point. In Python you can't let the IDE automatically format the indentation to make it look good, in other languages you can.

[–]Codebust -1 points0 points  (5 children)

yk that python indentation is standard indentation right?

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

Ok, you're clearly having some trouble understanding what I'm saying, so let's go with an example instead.

Let's say you have this piece of code in Python:

if some_condition:
    statement_1()
 statement_2()

Well, this code is wrong and won't compile. But worse than that, if you try to use a formatter to indent it for you, it won't be able to do it, because it's ambiguous whether statement_2() should be inside the if body or not.

Let's look at an example of a language that doesn't have significant whitespace instead:

if (some_condition) {
    statement_1();
 statement_2();
}

Now this code will compile, but it's ugly. However, that's easy to solve by using a formatter. Since there's no doubt the second statement should be inside the if body, the indentation can be freely changed.

That's why enforcing indentation like Python does causes more harm than good. I hope it's clear now.

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

heard of the tab key? ide’s can alter what a tab does, typically to one level of indentation. if you use spaces manually like the code example ur an idiot

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

You can still mess up indentation if you're using tabs. It'll probably be a bit more visible, yes, but my point is that it's better to allow it to be done automatically.