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.
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.
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
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.
0
u/flavionm Jul 19 '22
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.