+ 3

There is an actual objective reason of choosing tab or spaces to indent?

I saw many discussions on why one should be used instead of the other, but they don't usually have a good argument.

9th Sep 2017, 6:47 PM
Emilio Talamante Lugo
Emilio Talamante Lugo - avatar
7 Antworten
+ 14
Tab. Reason: laziness. OK, that's not really objective. But laziness is a wide spread disease among coders. So, it might be something like common sense. But I'm looking forward for better reasons like... indentation in Python?
9th Sep 2017, 6:54 PM
Tashi N
Tashi N - avatar
+ 6
@Baptiste Eclipse here, auto format save action (or Ctrl+i) -> tabs.
9th Sep 2017, 7:01 PM
Tashi N
Tashi N - avatar
+ 4
1 TAB saves you 6 SPACES!
9th Sep 2017, 7:10 PM
aj!
aj! - avatar
+ 3
@Tashi N, on some IDE (emacs is the one I know, and yes, emacs can become an IDE :p), you can press tab in the middle of a line to have it correctly indented, and pressing tab just add spaces and not the '\t' character
9th Sep 2017, 6:58 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
in Python it is crucial. if you mix spaces and "real" tabs the code will not work. I said "real" because many text editors and IDLE do substitute tabs for spaces.
9th Sep 2017, 7:01 PM
yuri
+ 3
Thanks for your responses. I am actually in favor of tabs to prevent the mistyping of spaces, it secures quality in your indentation, so my purpose was to know the benefits of using spaces. I like to see every perspective.
9th Sep 2017, 7:05 PM
Emilio Talamante Lugo
Emilio Talamante Lugo - avatar
+ 2
Tabs for the indentation, spaces to align. That said, tabs are a very good option, first because of the size (1 tab = 1 byte, and 4 spaces = 4 bytes), second because it makes the code more flexible to any editor configured with a specific tab size (some people use 2 spaces width, others use 6, I prefer 4).
10th Sep 2017, 2:26 AM
gerardbm
gerardbm - avatar