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.
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.
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.
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.
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.
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.
Some Oxide folks have talked about our experiences with Rust as web backend stuff, it's linked in the post but https://blog.jessfraz.com/post/the-automated-cio/ and https://twitter.com/ahl/status/1308421852931461126 We had to build a bunch of stuff because as you say, the ecosystem isn't super mature at times.
This is a poor analogy. Programming languages are used for writing programs. You suggest that Python is objectively superior in one context "scripting" than other programming languages. There are languages that are not cross-platform, that would fit that, there are languages like PL/SQL that are limited to databases, those are not practical for many program development efforts. In this context, we're really talking about two different types of hammers, perhaps one has a claw and the other does not, but they are both fairly portable and can target nearly all the same platforms.
But if Python is objectively better than these other general purpose languages, does that imply that there are areas where Python is not superior to these languages? Would it suggest that folks who've been successful even when choosing Python in those cases objectively made the wrong choice?
It's an analogy, but one tool is going to be faster and easier to use. So let's say a screwdriver vs an electric screwdriver.
> But if Python is objectively better than these other general purpose languages, does that imply that there are areas where Python is not superior to these languages?
Yes. There are a lot of areas where Python is inferior. In fact I'm using Rust right now for a project despite having over 15 years experience with Python. Programming languages are tools and they're better or worse suited to different tasks. There is no one language to rule them all - yet anyway.
> Would it suggest that folks who've been successful even when choosing Python in those cases objectively made the wrong choice?
Yes. That you were successful does not fully validate your decision about choice of programming language. It just means it wasn't that bad. It does not mean it was the optimal choice.
I wonder how much this has to do with you finding Python to be better suited to quick scripting tasks.
Even for small scripts, I find Python to be fairly clunky to use, and just having simple type checking would speed things up for me considerably.
Trying to replicate bioinformatics work is a huge PITA because of this type of approach.
I have had small 'scripting' tasks that are successful accrue enough feature creep over time and turn into a 10000 line behemoth (as far as quick and dirty scripts go). And at that point, you start hoping you hadn't slapped it together with the haste that you did and miss the easy refactorability that Rust gives you.
That is not a reason to start off thinking it will get that big, so you have to over engineer it, because the vast majority of scripts don't. You design to the most likely scenario.
Every single time my “quick” Python script has turned into something I use for more than a week I say “damn I wish I had written this in Rust”.
I think it is just your private /subjective opinion and it is not any better than mine.
Or maybe they assume that, if you have that, why wouldn't you make the jump to writing a REPL, since the hard part is done...
Just making some guesses.
"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"
To me it makes the impression that you are conflating here, hence my answer about REPL. Technically of course REPL is different from having "no compile time".
In any case I do not really consider opinion about Python being the better one for scripting tasks as anything but subjective.
It however does not have Python's batteries-included standard library. Luckily Opam is starting to make that less of an issue.
Given a specific task and 100 programmers equally skilled in both languages, they will accomplish the task faster in one. There will be a clear and statistically significant answer if one were to do a controlled study. It could be that the result is that they are nearly equal, but that would be a surprising outcome.
So when you say my opinion is the equal of yours, you're just saying you have no idea which is closer to the objective truth so you can't compare them. But fundamentally they are not equal and one opinion will be right and one will be wrong (in this case because it's a boolean outcome).
It is my opinion, it is subjective, but I also am willing to bet it's right. And there is a right and wrong answer here regardless of our ability to know it for sure.
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!
Here's a very simple one: 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...
How do you define quick? Python has a large standard library and so you don't have to hunt for functionality on crates.io and then download/compile -- I have written scripts faster than that.
Writing scripts with Rust likely will be slower than Python, but I don't really buy that having functionality in crates is part of that.
Except that, if its in the standard library, you don't have to choose between multiple implementations. I have written scripts faster than I have chosen dependencies.
Rust is a great C++ alternative. But seriously, the community has cult like marketing.
What in your opinion makes one language cult-like vs. another that many people like and recommend to others?
Cults generally have a very negative impact on those who are members vs. the leaders. Usually the members of cults are taken advantage of and are only there to support the people at the top.
The Rust community is very far from anything cult-like.
The documentation is great. Various channels to interact with the community have always been polite and helpful.
Heck, one would think that the author of a leading book on the language popping up everywhere to give helpful answers/clarifications would be seen as welcome and not in-your-face-activism.
The original poster was saying that generally cults will be rather unpleasant for most mid<->lower level members, but are pleasant for the people at the top (generally by extracting value from those lower-level members, whether it's labor, money, or sexual favors).
This seems a bit counterintuitive, of course - "if it's unpleasant, why the hell wouldn't they leave?". Usually cults have coercive tools that either make it difficult for someone to leave, or manage to brainwash them into believing they would be more unhappy outside of the cult.
[1] https://dictionary.cambridge.org/dictionary/english/anything...
Edit: acomar points out that the "haven't" negates what follows, so interpret what I wrote above as "the phrase on its own means not X".
I'm appalled at myself for the silly manner in which I phrased that. I guess I intended to say: "I have found it nothing but pleasant", but instead ended up tying myself up in knots.
For what Rust offers, it is unreasonably effective as a quick scripting language, with one big caveat: Once you’re accustomed to the language and have significant experience with it.
I’ve built and own CLI tools in Rust, used in production, where the alternative language choice was python, and the experience has been way better than I imagined. I expected to trade a ton of developer productivity for the extra speed and safety, but the reality is that it’s not even an integer multiple. Not even close. Again, my expectations were different, but in reality it’s been really pleasant.
Not including integration testing, the whole deal was two days of work. If I had to pull in and evaluate external libraries I would have spent two days just working out the details of which libraries to select.
At least for now, I don't think anything can replace Python for prototyping an idea.
I generally agree, but it has some weird holes. There isn't an OrderedSet, it doesn't have a binary tree like Java's TreeMap, its HTTP client isn't great (people mostly use Requests), and there's a lot still missing from its asyncio library.
> web UI for managing email sequencing
You built a web UI without even using Flask?!
- low-level programmers looking for safer tools to wrangle big, beastly projects.
- high-level programmers looking over the fence because this is the first low-level language that has a bunch of quality-of-life features that are "table ante" for them considering working in a language (most of them only tangentially related to safety, although the safety's probably a huge leg up for them). One of these features of course is the language getting mainstream and survivable enough that they know there will be a long-running library ecosystem.