Hacker News new | past | comments | ask | show | jobs | submit login

I'm rather amazed at the sheer number of human hours invested (wasted?) into making a terrible language(s) better just so things are slightly easier for beginners.



Assuming you're talking about Python, it's a product of its time. At the time it was released, it was very much following the newest "best practices" from "experts". You had lots of well-known people in the industry going to conferences and talking about how static typing was Actually Bad and unit testing was the one true way. (I won't bother explaining the retrospective idiocy of that.)

It's not a great language in a vacuum... but it is the most popular backend language in the world, by most estimations; there's a library for literally everything, and the entire data science ecosystem lives in the Python world. If you're on the management side, hiring a Python developer is orders of magnitudes easier than finding a Rust developer.

So you've really only got a few options... 1) throw everything out to rewrite it in Rust (et al); 2) accept that things suck and do nothing about it; 3) accept that things suck, but make some tooling to make it suck less. The rewrite strategy is a nonstarter for a lot of massive legacy codebases, so 3 is the only option that makes sense.

So it's really not that amazing how much time people invest in improving Python, when you think about it. Similar situation with PHP and Javascript.


> (I won't bother explaining the retrospective idiocy of that.)

Good, because people have done actual surveys to show there's no real decrease in bugs, and development time suffers: https://arxiv.org/abs/2203.11115

It's a trade off like anything else, Python has a lot of scientists who probably love not having to specify types everywhere. Python's best advantage is ease of development - Rust is in _no way_ an alternative in that department. Go would be a better choice.

It's biggest issue imo is it's slow, but since people aren't rushing to use mypy and friends, perhaps that's not important for most users. And it's had types for ages if you want them.


Even the article you linked flat-out says static typing is better:

> The analysis indicates that TS apps exhibit significantly better code quality and understandability than JS apps [...] Furthermore, reducing the usage of the `any` type in TS apps was significantly correlated with all metrics except bug proneness.

> It's biggest issue imo is it's slow, but since people aren't rushing to use mypy and friends, perhaps that's not important for most users.

People are rushing to mypy. Every Python library now has type stubs available. That wasn't the case even 3-4 years ago. Similar story with the mass move to TypeScript, which currently is the fastest-growing language[0].

Dynamic typing[1] is a legacy of ignorance and immaturity in the industry, from the same era where it was common to put your php $_GET parameters directly into a SQL query or access your C array without bounds checking. For the most part, the industry is smarter than this now, thankfully.

[0] https://visualstudiomagazine.com/articles/2023/02/02/jetbrai...

[1] note I'm really getting at "dynamic by default" -- there's certainly a use case for objects whose structures are only known at runtime, but that should be the exception, not the rule.


The article says code quality is better but development time and bug fixing time is worse. You chose to simplify that to 'better', I chose to see it as a tradeoff.

People are rushing to mypy for type checking, not speed improvements. I use cypthon and VS Code still does type checking for me; I don't care what program is doing it.

My argument is that truly static typing is too extreme in the other direction. Many times you don't care about type checking - quick scripts, data science, handling large JSON blobs - and informing the compiler is just boilerplate work. So I think we agree there that a static language with an 'any' type, like TypeScript, is the happy medium here.


Python is not a terrible language; neither is JS, or Ruby, or Lisp, despite being highly dynamic.

Python is indispensable for interactive experimentation (see Jupyter), and is a good glue language (see everything from Pytorch to Blender). It's also indispensable for rapid prototyping.

Python is not a good high-performance language. If performance is something that limits you, you should write performance-critical parts in a language optimized for that. Rust is a fine choice, but many other options exist, from Java to Haskell, and Python-integrated solutions like Cython also help. Note that usually 80-90% of your code is not performance-critical.

Same applies to systems where you want to formally prove certain correctness properties; both Python and C would be terrible choices.

By the same token, Rust is not a terrible language, despite its complicated syntax, the constant struggle with lifetimes and the borrow checker, and long compilation times. It shines when you need performance and correctness. If you need easy experimentation in a REPL, use a different language.

Use the right tool for the job.


I’m someone who spent a lot of time focusing on finding the most efficient tools, writing the most elegant code, using the most “pure” frameworks, etc. and I realized that this did very little to help me obtain my goals.

Unless your objectives are not commercial or will never scale beyond the ability of a single person, the overhead of human communication and collaboration will be enormous compared the inefficiencies of shuffling electrons and flipping bits with imperfect instructions. Sometimes this means using technically-inferior tools better than idealistic tools improperly to get the job done.


You're being downvoted, but I sort of agree...

How in the world can I stop worrying about errors like using a non existant class member and having a runtime exception? How can I refactor?

Ok, the core devs add annotations, then type hints to the language.

Some other people create MyPy, the JetBrains people use some other linting thing that does well, but does not match MyPy. The Pydantic appear and some other people says its awesome, but yet again, different to the others...

And all that to enforce things we already had 20 years ago in Java 1.0

How about using dynamic typing for small script and prototyping and using better tools for bigger projects?


Java 1.0 didn't have generics, so collection elements were only type-checked at runtime, and Java still doesn't have null-safety in the type system. The Python type annotations handle both of these things.


Yeah, why build better tooling or libraries for a language that lots of people use, right? That would be silly!


There is no shortage of programming languages that can choose from. Python seems to make the right tradeoffs between accessibility and power. The market has spoken.


It's not just about the market speaking. There's path dependence between it being easy to use for scripting and scientific things as well as bumpy which made it natural to supplant things like Matlab in teaching. And then basic knowledge translates to industry jobs.

It's not popular purely based on its merits as a language


Python is the keyboard of programming laguages.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: