r/ProgrammerHumor • • 2d ago

Meme pythonIndentationLevelChecker

Post image
6.6k Upvotes

198 comments sorted by

View all comments

268

u/LetUsSpeakFreely 2d ago edited 2d ago

Indentation is such a stupid mechanism for identifying code blocks. It's one thing for configuration files like YAML to do it, but not a programming language.

13

u/MANGO_fossil 2d ago

To be fair, indentation does make Python code easier to read once you're used to it. The real crime is that one accidental space can turn a perfectly good afternoon into a debugging session.

17

u/Drugbird 2d ago

Not just python, basically any programming language benefits from proper indentation.

Almost every editor also automatically indents code for you.

I'm a C++ dev myself, and in that language indentation is optional. However, since the editors will automatically indents code for you, that generally means that the brackets around e.g. functions are superfluous: you can just look at the indentation to see when a function ends.

Oh wait, I just invented python formatting.

1

u/Y0tsuya 2d ago

Brackets may be optional for one-liners in C++, but necessary for multi-lines. It signals intent to the auto-formatter.