4 ms·
I understand comparing Rust to C++ and Go, maybe even Java but Python? Python is a totally different niche and including it in this comparision kinda makes me q
by V__ 5y ago
I understand comparing Rust to C++ and Go, maybe even Java but Python? Python is a totally different niche and including it in this comparision kinda makes me question the whole articles intention and assessment.
- kbd 5y agoThis is indeed a superficial article: > Rust vs Python: advantages > Rust is well-designed. Rust allows for putting statements in a lambda and everything is an expression, so it’s easier to compose particular parts of the language. Python lacks it. Rust doesn’t have classes so the object orientation is not as evolved as it is in Python. Python also comes across with the necessity of writing more tests, production outages, or runtime crashes. Rust makes it less expensive to identify and fix possible bugs.
- bigdubs 5y agoRust definitely has advantages for safety and correctness. Those advantages come at a cost, specifically in terseness and readability, which are both _strengths_ of Python. As a result, they're very different tools, and comparing them shows that the author doesn't grasp their relative strengths and how those apply to their typical use cases.
- zozbot234 5y agoPython may be "terse and readable" when you're only dealing with very simple scripts, but the advantage quickly disappears in larger programs, where issues of modularization and, yes, correctness become paramount. It's choosing the wrong tradeoff in the first place. Rust makes the opposite choice, a small tradeoff in readability when starting out, in exchange for a long-term gain.
- bigdubs 5y agoNot every project is large, there are plenty of things that don't need the burdens that larger projects place on the code to just get things done and get them done well.
- paulgb 5y agoI do agree that the article has issues, but I have found Rust to be a surprisingly good replacement for a lot of my Python use-cases. For example, I’ve been using actix-web and more recently axum for little servers that I would have previously written in Flask. I’ve also ported over some data munging jobs —- using serde feels like having superpowers. And in tasks like these, I usually don’t even miss having a garbage collector, and rarely need lifetime annotations.
- V__ 5y agoCould you expand on this a bit? What did you like about the switch and what not? Just in case: I didn't want to imply there are no use cases which overlap, only that in general the use cases for both languages are very different.
- paulgb 5y agoI like how much the compiler helps me. I find it to be a tax on my productivity for about the first 1500 LOC of a project, but once I get beyond that, the compiler is an indispensable aid for refactoring in a way that Python’s type system (even with annotations) just isn’t rich enough to enable. For example, if I add a variant to an enum, my editor will immediately show me all the places that variant needs to be handled. I find cargo more productive than Python’s package management, where I have to manually manage environments and requirements.txt files. Things I like less: less “batteries included”, so I spend more time evaluating libraries and wondering if a github project hasn’t been touched since 2019 because it just works, or because the maintainer got bored. The learning curve is steep at times, and involved being blocked on pleasing the compiler.
- V__ 5y agoThank you for your insights!