4 ms·
I love rust, but Python is still my goto for scripting, small tasks, calculations, etc. It's more convenient for nearly all tasks of that shape. I remember tel
by eloff 6y ago
I love rust, but Python is still my goto for scripting, small tasks, calculations, etc. It's more convenient for nearly all tasks of that shape.
I remember telling my uni professor about that 15 years ago, but she swore by using C for that purpose. It's what you know I suppose, but if you know both languages, Python is much better suited to the task.
- bluejekyll 6y ago> Python is much better suited to the task. This is not an objective opinion, but subjective. People generally appreciate different things about different languages, and it’s entirely possible for some who knows both languages to disagree with you here. For quick CLI tools, my favorite thing about Rust is that it has really high quality command line parsers available in the community, and they are type safe. I’m not suggesting that your opinion is wrong, only that the way you phrased it implies that many people could come to the same objective opinion, while there’s plenty of evidence that folks pick languages they enjoy and prioritize different things than you might.
- eloff 6y agoThere's this political correct thing where people act like there's no objective truth and everything is subjective. That's just not how reality works, there is usually an objective truth even when we can't agree on what it is. You can use a hammer and a screwdriver for putting screws into drywall, but one tool is objectively better, under most conditions, regardless of your personal opinion. Python is superior to C and Rust for most kinds of scripting tasks, given equal mastery of both. It has a REPL, it doesn't have a compile time, it has a great batteries included standard library. There are plenty of specific tasks that will be exceptions, but that's my subjective opinion. I also think it's closer to the objective truth - and that people who have a different opinion are simply wrong. I'm not afraid of calling it how I see it. I could be wrong here, but I don't think that's the smart money bet.
- steveklabnik 6y agoI mean, I should probably turn this comment into a blog post, but https://news.ycombinator.com/item?id=22712441 https://news.ycombinator.com/item?id=22712441 That Python and that Rust are not very far off from each other. Rust is surprisingly good at these tasks for people who already know Rust. It's not as far out as you seem to think. That being said, I am quite sure that Rust is not going to take over as a scripting language or something. But at the same time, it is not completely ridiculous to write some Rust for these sorts of tasks if you're already comfy, and if the libraries are there.
- eloff 6y agoI shouldn't be surprised to see you defending Rust here :) I do see a lot of similarities between Rust and Python. I don't agree that it's better than Python for most short scripting tasks - but I will grant your point that it's not completely ridiculous either, not by a long shot.
- steveklabnik 6y agoHonestly, I am surprised; if you go read my old Hacker News comments, you'll see me saying that I don't think Rust will ever make sense for the backend of websites. I have been pleasantly surprised as things have developed.
- eloff 6y agoI don't have anywhere near your level of experience with Rust. But yeah that's been surprising to me too. I still think I'd rank it behind Go and Python for a typical website backend - but it depends on the project and the team. The more people involved, the more things the type system will save you from, and the more you benefit from being able to build powerful abstractions - which offsets the relatively higher "tax" on productivity with it. Rust is one of the better choices for backend web development today, a sentence I also find surprising just to write. Honestly, probably the biggest thing holding it back for that use case is not the language itself but lack of adoption. It's tougher to hire for, and has a less mature ecosystem. I feel the momentum is there and that will change over the next 5 years or so.
- jdub 6y agoUnless you're writing libraries, Rust feels a lot like Python. One thing that sticks out in a scripting mindset is the various string types, but I mostly accept that as a small price to pay for doing things correctly (OS strings vs. UTF-8 vs. C strings). Because of the kinds of things I build with Rust, I've had to write quite a few cargo build scripts (build.rs files), which are very bash/Python script-y in nature. Not once have I wished for a different language!
- aboodman 6y agoCan you point me to some open source examples of these? I work in Rust and I cannot for the life of me imagine describing it as "scripty". On the contrary I feel constantly bludgeoned by the type system whenever I have to do something in that realm (e.g., a unit test).
- jdub 6y agoOh, I was describing the nature of build.rs files as script-y, rather than Rust itself. :-) Here's a very simple one: https://github.com/alexcrichton/brotli2-rs/blob/master/brotli-sys/build.rs https://github.com/alexcrichton/brotli2-rs/blob/master/brotl... Here's one with much more complicated requirements: https://github.com/sfackler/rust-openssl/blob/master/openssl-sys/build/main.rs https://github.com/sfackler/rust-openssl/blob/master/openssl...