Discuss Scratch
- gosoccerboy5
-
1000+ posts
Tabs vs spaces
The ultimate battle. Which one do you prefer?
I'm a spaces guy.
I'm a spaces guy.

- -Accio-
-
1000+ posts
Tabs vs spaces
Tabs. More distinct difference and if you don't have an auto indent editor, it is easier to press tab once than space 2/4 times. Same with backspacing. I would rather backspace one tab than 2/4 spaces.
- dhuls
-
1000+ posts
Tabs vs spaces
I completely agree with this. Tabs. More distinct difference and if you don't have an auto indent editor, it is easier to press tab once than space 2/4 times. Same with backspacing. I would rather backspace one tab than 2/4 spaces.
- Steve0Greatness
-
1000+ posts
Tabs vs spaces
I only use space, when I'm trying out a new software that lets me make html(or any text document… yes html is text), and it doesn't let me use tab.
Space is bad and I turned off tab to space in the Chrome OS text app

Space is bad and I turned off tab to space in the Chrome OS text app

Last edited by Steve0Greatness (May 28, 2021 03:35:47)
- fdreerf
-
1000+ posts
Tabs vs spaces
None. I write all my code in Microsoft Word with center justification.
- Sheep_maker
-
1000+ posts
Tabs vs spaces
I think the main benefit of tabs is that it lets you customise its width, kind of like dark theme/light theme. Tabs for indentation, spaces for alignment.
Perhaps, though I feel like most editors that insert a tab character when you press tab also support space indentations. Tabs. More distinct difference and if you don't have an auto indent editor, it is easier to press tab once than space 2/4 times. Same with backspacing. I would rather backspace one tab than 2/4 spaces.
- Chiroyce
-
1000+ posts
Tabs vs spaces
Tab
That's for HTML! What about JS or Python? None. I write all my code in Microsoft Word with center justification.
Last edited by Chiroyce (May 28, 2021 06:34:17)
- linearlemur
-
500+ posts
Tabs vs spaces
Spaces. For me, the tab button is located at a really awkward spot on the keyboard, and I'm much more used to spaces. Also, it's easier to type a button multiple times quickly than one button slowly.
- gosoccerboy5
-
1000+ posts
Tabs vs spaces
Soft tabs allow you the benefit of tabs with the flexibility of spaces
- Sheep_maker
-
1000+ posts
Tabs vs spaces
Wait—you prefer manually typing out each space? o_O Spaces. For me, the tab button is located at a really awkward spot on the keyboard, and I'm much more used to spaces. Also, it's easier to type a button multiple times quickly than one button slowly.
Hmm, I wonder which languages ignore ඞ as whitespace or a comment. BrainF is one of them—characters outside its 8 character set are ignored—and perhaps HTML if you use a font that makes ඞ invisible i only indent my code using ඞ
More languages allow ඞ in their variable names, though:
(define ඞ 'amogus)
let ඞ = 'amogus'
.ඞ::after { content: 'amogus' }
- imfh
-
1000+ posts
Tabs vs spaces
I prefer spaces, because it is the Python standard. Most modern code editors support making them act like tabs in regards to the tab key and backspace, so I don’t see that as a problem.
Although it is nice that tabs can be customized with themes, I don’t really see that as much of an advantage either. I prefer a standard 4 space size, and it seems the vast majority of people who publish code do too. If someone prefers a different size, they can always convert my spaces to tabs later.
One advantage of using spaces is that your indents don’t all have to be the same size. If you use tabs, you have to use a combination of tabs+spaces to get specific indent position, which not only doesn’t seem like good practice (mixing whitespace), it is also a big no no for Python (throws an error in Python 3).
Here’s a couple snippets of actual code I wrote which use varying indents using spaces.
See how spaces are used to line up self.color.b with self.color.r (there are 29 spaces before self.color.b)
Also, here's a mess I found when I was looking for an example. It has custom spacing in front of the for loop. Can anyone tell what it does out of context like this? 
Here's the regex I used to find these if anyone wants to check their code to see if they've used custom spacing somewhere.
Although it is nice that tabs can be customized with themes, I don’t really see that as much of an advantage either. I prefer a standard 4 space size, and it seems the vast majority of people who publish code do too. If someone prefers a different size, they can always convert my spaces to tabs later.
One advantage of using spaces is that your indents don’t all have to be the same size. If you use tabs, you have to use a combination of tabs+spaces to get specific indent position, which not only doesn’t seem like good practice (mixing whitespace), it is also a big no no for Python (throws an error in Python 3).
Here’s a couple snippets of actual code I wrote which use varying indents using spaces.
See how spaces are used to line up self.color.b with self.color.r (there are 29 spaces before self.color.b)
pen.color = pg.Color(self.color.r, self.color.g, self.color.b, self.color.a)

blockmap['code'] = "async def " + clean_identifier( "cb_" + mutation['proccode']) + "(self, util, " +\ ', '.join(clean_identifier("arg_" + arg) for arg in json.loads(mutation['argumentnames'])) +\ "):\n{SUBSTACK}"
\n( {4})+? {1,3}\S
- NormalMaker
-
500+ posts
Tabs vs spaces
For the purpose of indenting, tab, because the only time I need to indent things is when I'm making trashy programs in python for school, which doesn't require specific amounts of indentation, and there's no reason to press space 4 times when I could press a button that's right above a button that I use every 5th line.
- mybearworld
-
1000+ posts
Tabs vs spaces
Only spaces. Python automatically uses spaces, so I'm way more used to just tapping space 4 times (and in JS I just use 1 space)
Last edited by mybearworld (May 29, 2021 13:25:10)
- gosoccerboy5
-
1000+ posts
Tabs vs spaces
Modern code editors will automatically indent on a newline based on the previous line.. For the purpose of indenting, tab, because the only time I need to indent things is when I'm making trashy programs in python for school, which doesn't require specific amounts of indentation, and there's no reason to press space 4 times when I could press a button that's right above a button that I use every 5th line.
- imfh
-
1000+ posts
Tabs vs spaces
The pain of seeing so many people who don’t know how to set their editor to insert 4 spaces when you hit tab. Please do yourself a favor and figure out how to set that up. Only spaces. Python automatically uses spaces, so I'm way more used to just tapping space 4 times (and in JS I just use 1 space)
- mybearworld
-
1000+ posts
Tabs vs spaces
[View post]I guess I could see if I find that in IDLE, but I don't think you can do that in Notepad (for JS)-The pain of seeing so many people who don’t know how to set their editor to insert 4 spaces when you hit tab. Please do yourself a favor and figure out how to set that up. Only spaces. Python automatically uses spaces, so I'm way more used to just tapping space 4 times (and in JS I just use 1 space)
Edit: IDLE actually already does that, I still prefer spaces.
Last edited by mybearworld (May 29, 2021 13:40:20)
- Maximouse
-
1000+ posts
Tabs vs spaces
Install an actual code editor instead of using Notepad. I guess I could see if I find that in IDLE, but I don't think you can do that in Notepad (for JS)-
I thought IDLE replaces tabs with spaces by default?
Edit: It does, and it isn't even possible to disable that.
Last edited by Maximouse (May 29, 2021 13:40:46)
- mybearworld
-
1000+ posts
Tabs vs spaces
[View post]It does, I just didn't care for the “tab” button enough to notice that.Install an actual code editor instead of using Notepad. I guess I could see if I find that in IDLE, but I don't think you can do that in Notepad (for JS)-
I thought IDLE replaces tabs with spaces by default?

Also why would I install a code editor? Notepad works fine.
Last edited by mybearworld (May 29, 2021 13:41:52)