|
|
|
|
|
by Beltalowda
1323 days ago
|
|
This is one of those things that started out as good advice, and then got turned in to an oversimplified parody of the original argument. If you have something like: var (
x = foo
other = bar
)
Then clearly you should use spaces to align those "="s, no matter if you use spaces or tabs for indentation. Similarly, "hanging indents" like: coolFun(arg1,
arg2)
Can only be done correctly with spaces, and it doesn't really matter if you use tabs or spaces for indentation; this will still align correct no matter the tabstop size: ->coolFun(arg1,
-> arg2)
--->coolFun(arg1,
---> arg2)
------->coolFun(arg1,
-------> arg2)
If you had used tabs, changing the tab size would make it align all wrong.The problem is when you start doing stuff like: if (one) {
------>if (two)
bar();
------>else
xxx();
}
And then, depending on the tabstop size, things can start looking very misaligned and confusing; this is why Python 3 forbids mixing tabs and spaces in the same function, because it's so easy to make something appear wrong and there are no braces to clarify things.That's what people mean with "don't mix tabs and spaces", not "if you use tabs then the space shall never appear in the file under any condition". |
|
This is clearly false. You said this after giving a perfect example of how it's done with tabs.