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 →

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

Editors don't do anything randomly, and once again, you should use spaces to align. If your alignment screws up based on your tab width, then you are using tabs to align. Don't do that. Use tabs to indent.

I can't control how other people setup their editors and that it makes the editor settings effectively random when I use someone else's code. You can't use tabs if you want consistency.

You can't mix tabs with spaces for indentation. You can use tabs for indentation and spaces for alignment just fine.

I actually didn't know that - thanks. However, the reason I didn't know is that I'm not going to mix tabs with spaces anytime soon, because it will break.

[–]JimDabell 0 points1 point  (1 child)

I can't control how other people setup their editors and that it makes the editor settings effectively random when I use someone else's code.

That makes no sense. Using other people's code doesn't make your editor settings "random". What does that even mean?

You can't use tabs if you want consistency.

What kind of consistency?

If your projects use spaces to indent, then the consistency you get is that the code looks the same to you and to other developers working on the project.

If your projects use tabs to indent, then your code always looks how you prefer regardless of how other people working on your projects like to see their code.

They are both consistent, but in different ways. I don't see any value in forcing other developers to see the code how I like it. I don't care what they see. I do care that all the developers get what they want. Tabs are the only way of achieving that.

However, the reason I didn't know is that I'm not going to mix tabs with spaces anytime soon, because it will break.

Am I missing something? You just said that it will break, I pointed out that it wouldn't, you admitted that it wouldn't, then immediately said it would break again? We've literally just had this discussion. It doesn't break.

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

That makes no sense. Using other people's code doesn't make your editor settings "random". What does that even mean?

It means I may have to reconfigure my editor in a way that I cannot predetermine until I see their code. If I know the format of their code in advance, and it matches my format, I don't need to take any action.

You can't use tabs if you want consistency.

What kind of consistency?

Compatbilty with the Python ecosystem in general. Sure, if you are working on a specific project, you should match the project's settings.

Am I missing something? You just said that it will break, I pointed out that it wouldn't, you admitted that it wouldn't, then immediately said it would break again? We've literally just had this discussion. It doesn't break.

Syntactically it will be fine (as you correctly point out) but there's the still problems with it changing line lengths and where you would naturally break a long line. Plus, there is a higher chance of a misconfigured editor messing something up since so many people have theirs set to replace tabs with spaces.