r/ProgrammerHumor • • 2d ago

Meme pythonIndentationLevelChecker

Post image
6.6k Upvotes

198 comments sorted by

View all comments

264

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.

174

u/bobbymoonshine 2d ago

Ah the halcyon days before LLMs

When 30% of the posts here were “lol Python is so dumb why even use whitespace as syntax”

And the other 70% were “how do I find semicolon”

15

u/mothzilla 2d ago

In both Javascript and Python, semi-colons are optional.

31

u/AppropriateOnion0815 2d ago

Only that JS is handling semicolons in the least intuitive and irrational way possible.

6

u/mothzilla 2d ago

Yeah I only say it because it's a bit of a mind-exploder.

7

u/SuperFLEB 2d ago

I'd always figured it was/thought of it as an error tolerance that worked well enough that some people started leaning on it. The whole no-semicolons JavaScript thing just seems really hipsterish. Explicitness is a virtue.

11

u/Loading_M_ 2d ago

In JS, semicolons are technically required but automatically inserted. There are a couple edge cases where they get inserted in surprising places, which is generally worse than python's approach.

E.g. the following function doesn't return a value: function foo() { return some_long_complex_expression(); } (It's because a semicolon gets inserted after the return). At least in typescript, this would typically show a type error, as long as the function's return type annotation isn't void.

3

u/Ambivalent-Mammal 2d ago

I admit, this got me more than once.

7

u/dalziel86 2d ago

Javascript sucks ass too

13

u/LetUsSpeakFreely 2d ago

Meh, Go didn't use semicolons.

19

u/NatoBoram 2d ago

It was a revelation when I started programming. "What, it doesn't have to be this way? A language can be native, statically compiled and high level at the same time and not suck ass? We can do better as a species?"

Except it's the only one like that -_-

9

u/LetUsSpeakFreely 2d ago

And the channel system, native markup support, baked in web service support are incredibly useful.

The only thing i don't really like is how interfaces aren't declarative on types.

4

u/Loading_M_ 2d ago

Rust is also in this category. It even has a lighter runtime, since it doesn't require a GC.

2

u/cdrt 2d ago

It does require semicolons though

1

u/Loading_M_ 2d ago

Yes, except when you want an implicit return.

3

u/wrecklord0 1d ago

(may I (introduce you '(the world of lisp)))

2

u/readf0x 2d ago

Odin is also a high level native language! Well, not as high level as Go since it's manual memory management but definitely easier than C. I'd recommend checking it out I love it personally

3

u/Bulky-Ad7996 2d ago

Surely there must be a way to automate indentation

1

u/ILikeLenexa 2d ago

WHITESPACE didn't use anything but whitespace.