this post was submitted on 05 Sep 2023
1320 points (97.4% liked)

Programmer Humor

19623 readers
411 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

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] amanaftermidnight@lemmy.world 19 points 1 year ago* (last edited 1 year ago) (3 children)

Most disingenuous post ever.

The image shown is a dude with a browser dev console, probably measuring a div for the its CSS size (which do support centimeters and inches).

In python, 4 spaces is just enough spacing between indent levels. And if your levels get too deep it's a sign that you're not being pythonic. Nesting too deep is the problem, not the whitespacing being significant.

[–] UlrikHD@programming.dev 17 points 1 year ago (1 children)

Python are fine with whatever number of spaces you want to use. You can use 8 spaces which forces you carefully consider each nest, you can use 1 if you're a monster, or you can use tabs if you're enlightened, python only demands consistency.

[–] joey_moey@feddit.dk 2 points 1 year ago (1 children)

Yeah I remember picking up a script after a reinstall, and gedit had reverted to default settings. It's fun trying to spot whether it's 1 tab or 4 spaces. After that day, I switched to two spaces as my default.

All theese indentation issues arises from using spaces instead of tabs. And tabs are really flexible so that everyone can set their text editor to whatever tab length they want and still be consistant

[–] JonEFive@midwest.social 2 points 1 year ago

This post on programmer humor is now funnier as a result of your analysis. Everything is funnier when it is 100% accurate.

[–] mexicancartel@lemmy.dbzer0.com 2 points 1 year ago (2 children)

Why not TABs? I hate 4 spaces cuz it can get real messy sometimes.

[–] amanaftermidnight@lemmy.world 1 points 1 year ago (1 children)

My editor turns tabs into 4 spaces. No more "mixing tabs and spaces" errors afterwards.

Thats the problem. Then you commit. I clone it. I can't use tabs because you turned everything into spaces. Why not turn spaces into tabs?

[–] CoderKat@lemm.ee 1 points 1 year ago (1 children)

I normally love tabs and it's what Go uses both by convention and it's semi opinionated formatter. But PEP-8 suggests spaces and ultimately, consistency is more important.

Not having to argue about tabs vs spaces lets us focus on the real problems, like vim vs emacs.

I am aware but don't know why four spaces is suggested. Tabs are consistant and flexible. Using spaces might cause errors in number of spaces and makes code messy.

Also emacs for the win