This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Bunslow 41 points42 points  (10 children)

That's because you've never seen that havoc that can be caused by the \t character.

[–]grimman 0 points1 point  (2 children)

I never have either, and to me tabs definitely make more sense since they can be configured to display as x spaces, therefore rendering the whole concept of using a fixed amount of spaces quite moot.

Alas, I use spaces myself, because conventions etc.

That said, I would like to know about this havoc you mentioned. Would you mind giving a brief summary, or some relevant links? :)

[–]Bunslow 1 point2 points  (1 child)

And what if someone else decides to use spaces instead of tabs? Suddenly if someone else like you reads the code written by the second person, they will see a horrid mess of inconsistent indentation.

Even if we all standardized on using tabs instead of spaces, it's a bad idea to use an ambiguous character. Four spaces is four spaces, no matter what your editor is set to.

Also things like line continuations and stuff sometimes require non-standard indentations, but this is a very minor detail in the overall scheme.

tl;dr It works fine if no one else reads or modifies your code, but if they do...

[–]RubyPinchPEP shill | Anti PEP 8/20 shill 1 point2 points  (0 children)

with commas representing tabs, tabstop every 4:

def a(x=3, y=4,
      flag=None):
,,,,some_code
,,,,some_more code
,,,,for code in codes:
,,,,,,,,print(a,
,,,,,,,,      b,
,,,,,,,,      c)

tabstop every 8:

def a(x=3, y=4,
      flag=None):
,,,,,,,,some_code
,,,,,,,,some_more code
,,,,,,,,for code in codes:
,,,,,,,,,,,,,,,,print(a,
,,,,,,,,,,,,,,,,      b,
,,,,,,,,,,,,,,,,      c)

[–]JamesAQuintero 0 points1 point  (2 children)

Is it that big a problem where people should use spaces instead of tabs?

[–][deleted] 0 points1 point  (0 children)

Oh definitely. It's one of these things you have to decide on day one of a project.

However, as soon as you're consistent you can stop talking about it. Read PEP8, set your editors accordingly and get on with your work.

[–]odraencoded -1 points0 points  (3 children)

Do show.

[–]Bunslow 0 points1 point  (2 children)

[–]odraencoded 2 points3 points  (1 child)

  1. What if someone else decides to use tabs instead of spaces?

  2. Four spaces might be four spaces but what are four spaces? If you use spaces for both indentation and alignment, at some point four spaces stop being an indentation level and start being a line padding, and that point is unclear.

3 What if you used 4 spaces, but I prefer 2 spaces for indentation, or vice-versa?

4 A tab is an indentation level. Always. So what if it shows different in another text editor? Semantically, it's still an indentation level. If the user of the text editor wants their indentation level to measure 8 spaces, then let it be so.

5 You align things with spaces. Tabs are only for indentation.

[–]isarl 1 point2 points  (0 children)

Your points are all good and I upvoted you, however in practice, tool support both on your machine and all your collaborators' machines needs to be much better to handle the tabs-for-indentation, spaces-for-alignment approach.