this post was submitted on 28 Nov 2024
464 points (88.5% liked)

Programmer Humor

32730 readers
285 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 113 points 3 weeks ago (44 children)

Lmao, bruh. How do people keep praising a language where messing up a space breaks everything and there is no real type system?

[–] riskable 20 points 3 weeks ago* (last edited 3 weeks ago) (14 children)

Haha: "A space breaks everything." Fuck YES! Are you kidding me‽ It's one of the best features!

Why? Because it's so easy to see. In other languages you've got semicolons which are surprisingly difficult to notice when they're missing. Depending on the situation (or if you're just new to programming) you could spend a great deal of time troubleshooting your code only to find out that you're missing a semicolon. It's frustrating and it makes you feel stupid which is never a good thing for people who are new programming.

Types are in a different category altogether with seemingly infinite reasons why you'd want a feature-rich, low-level type system and also why you'd want to avoid that.

IMHO, the point of Python is to be a simple language that's quick to write yet also very powerful and speedy when you need it to be (by taking advantage of modules written in C or better, Rust). If it had a complex type system I think it would significantly lower the value of the language. Just like how when I see an entire code repo using Pydantic and type hints everywhere it makes the code unnecessarily complex (just use type hints where it matters 🙄).

I'm not saying using type hints on everything is a terrible thing... I just think it makes the code harder to read which, IMHO defeats the point of using Python and adds a TON of complexity to the language.

The promise of type hints is that they'll enable the interpreter to significantly speed up certain things and reduce memory utilization by orders of magnitude at some point in the future. When that happens I'll definitely be reevaluating the situation but right now there doesn't seem to be much point.

For reference, I've been coding in Python for about 18 years now and I've only ever encountered a bug (in production) that would've been prevented by type hints once. It was a long time ago, before I knew better and didn't write unit tests.

These days when I'm working on code that requires type hints (by policy; not actual necessity) it feels like doing situps. Like, do I really need to add a string type hint to a function called, parse_log()? LOL!

[–] [email protected] 5 points 3 weeks ago* (last edited 3 weeks ago)

Exactly! I've wasted more time hunting missing semicolons in languages that use them, than fixing wrong indentation in Python.

load more comments (13 replies)
load more comments (42 replies)