this post was submitted on 28 Jul 2024
1298 points (99.0% liked)
Programmer Humor
19463 readers
255 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
It's just YAML...
YAML makes you appreciate Python's 4 spaces indentation.
I thought python allowed whatever indentation you wanted as long as it's consistent?
pep8 calls for 4 space but it is a guidance not a rule.
Google internal style guide recommend(ed?) 2 spaces to accomodate the line length limit.
It does, but most style guides and autoformatters will use 4
Python is one of the few languages with an official style guide, I think that guide says 4 spaces.
Tabs!
I've set tabs to four spaces in vim because who the fuck defaults tab to eight spaces. That shit looks alien and pushes text off the screen fast.
Linux uses 8 spaces. Excerpt from the official style guide:
The reasoning seems sound, but I still prefer 4 personally.
I don't develop kernel modules, I use python. That's pretty interesting though.
I set my clang-format to tabs only (actual tabs ASCII 0x9, no alignment and there is a continuation tab instead), then anyone can set their editor to whatever tab length they feel like and look at their code however they want.
But no spaces on the left of my code. This is for C, C++ and JSON.
4 tabs is a bit overboard, don't you think?
4 spaces? Hard core Python programmers must have a callus on their thumbs.
Just assign tab to 4 spaces.