You're viewing a single thread.
Python: So you used spaces and tabs for indentation? NOW DIE!
80 3 ReplyMixing spaces and tabs should be a warcrime.
47 0 ReplyAnd in Python, it's merely a SyntaxCrime.
9 0 ReplyFind me anyone who claims they use tabs for indentation, and I bet I'll find at least one case where they're using both tabs and spaces.
The only safe way to avoid war crimes is to avoid tabs.
8 13 ReplyDon't IDEs just replace any tab with 4 spaces anyways? Pretty sure VSCode does
8 1 ReplyI don't use an ide, but I wrote a script that replaces any space I type with four.
I haven't worked out all the use cases yet, though.
4 0 ReplyThat's a setting in the editor.
3 1 Reply
Why would I use spaces if I use tabs? Also, it seemd like a huge waste of time hitting the space bar so many times...
10 3 ReplyWhy would I use spaces if I use tabs?
To comply with Python's best practices:
https://peps.python.org/pep-0008/
Also, if you work on the Linux Kernel, you'll see a mix of tabs and spaces:
https://elixir.bootlin.com/linux/latest/source/block/bfq-iosched.c#L390
Also, it seemd like a huge waste of time hitting the space bar so many times…
You use an editor that doesn't auto-indent?
9 2 Reply
I use the tab key but I'm pretty sure vs code converts that to spaces
8 1 ReplyDepends on your settings, but yeah typically it does
4 0 ReplyIt worries me that a programmer wouldn't know for sure what's happening when they hit tab, and that it's a setting that can be changed.
2 1 ReplyI mean I was 99% sure it convert to spaces, I cannot say I was certain. The default settings are fine for what I do, I only ever had to change the spacing from 4 to 2 spaces once when dealing with someone else's files
2 0 Reply
Linux kernel?
https://www.kernel.org/doc/html/v4.10/process/coding-style.html#indentation
edit: oh python, nevermind
3 0 ReplyThe kernel definitely mixes tabs and spaces:
https://elixir.bootlin.com/linux/latest/source/block/bfq-iosched.c#L390
2 1 Reply
Good. Spaces and tabs for indentation should never be mixed in any language other than Whitespace.
23 0 ReplySome people use tabs for indentation and spaces for alignment. It kind of gets the pros of tabs (user configurable indent-width) and the pros of spaces (alignment). That doesn't work in Python where you can't align stuff and the interpreter doesn't allow mixing tabs with spaces, but in other languages it is a possible style.
4 0 ReplyThere are no pros to tabs. Configure tabs to a number of spaces.
2 3 Reply
Raw adjust with tabs, fine adjust with spaces.
Don't laugh, people are actually doing that.
3 0 Reply
Mixing tabs and white spaces in 2024 is categorically a you problem lmao
6 0 ReplyAre you ok?
4 0 Reply