| Off Topic > Off Topic |
| Programming Megathread |
| << < (73/241) > >> |
| Gytyyhgfffff:
--- Quote from: Alyx Vance on January 26, 2016, 11:37:18 AM ---Why does it matter? You pick on everyone when they do something just slightly different. --- End quote --- we're having a debate about wether tabs or spaces are better in a debate you generally pick on other people's opinions |
| FelipeO_O:
--- Code: ---#This is a code in Python what tells you the min of 3 numbers def min(a,b): return a if a < b else b def min1(a,b,c): return min(a,b) if min(a,b) < c else c print("min(5,1) = %d" % min(5,1)) print("min1(5,1,2) = %d" % min1(5,1,2)) --- End code --- output: min(5,1) = 1 min1(5,1,2) = 1 |
| Foxscotch:
--- Quote from: Gytyyhgfffff on January 26, 2016, 11:36:57 AM ---but then why hit the spacebar four times when you can just hit tab once --- End quote --- you hit tab once, using any decent text editor which, when the settings are changed, will automatically insert four spaces (the only text editor I know of that does not do this is notepad) or, if for some reason you want a different number, then a different number. even with a different number you are still guaranteed that it will be the same size to anyone who looks at it exceptional editors also sometimes work backwards, removing the number of spaces that corresponds to those settings when you press backspace. but that's less common |
| Headcrab Zombie:
A tab isn't comparable to any number of spaces, because that's not how they work. Four spaces is just four characters across, whereas a tab aligns you to the next tab stop --- Quote from: Foxscotch on January 26, 2016, 10:54:56 AM ---spaces are always one character long. but tabs are unpredictable. someone may have theirs set to 2 characters or 8. so it is impossible to ensure that your lines will fit within 80/100 columns if you use tabs --- End quote --- That's one reason why you do use tabs. If someone has their text editor set to a given length for tabs, it's because they want them like that. You don't just go "no forget you you're seeing them at 4 now because I said so" Also four spaces is four times as many key strokes |
| Foxscotch:
--- Quote from: Headcrab Zombie on January 26, 2016, 11:55:12 AM ---That's one reason why you do use tabs. If someone has their text editor set to a given length for tabs, it's because they want them like that. You don't just go "no forget you you're seeing them at 4 now because I said so" Also four spaces is four times as many key strokes --- End quote --- it doesn't matter what they want their tabs to look like, because the point is to make sure your code is readable. no matter what number you use, if you use a certain amount of spaces, you can, absolutely, make sure every line appears under 80 characters long for every person looking at it would you write any other parts of your code differently because it's what someone else prefers? and like I said, notepad is the only text editor I've ever used that does not have a setting to insert a certain number of spaces when you press tab |
| Navigation |
| Message Index |
| Next page |
| Previous page |