6 ms·
Why is that? I'm genuinely curious. Also, what languages / environments do you prefer?
by REDS1736 2y ago
Why is that? I'm genuinely curious. Also, what languages / environments do you prefer?
- 01HNNWZ0MV43FF 2y agoNot gp but I prefer rust to python and I'm itching to try that "just write your build scripts and stuff in rust too" Sure the builds are slow and Python _kinda_ has static typing, but rust just has a lot of stuff I like and it's practical to install and use natively without learning all the jargon like venvs and eggs and wheels and which package manager and package manager manager (rye?) to use this year I tried Python years ago and never got the motivation to push through that learning curve. I've used c++ a lot but it always required me to "keep my hands inside the ride at all times". Rust feels like it actually wants to be easy to use
- gorjusborg 2y agoThe idea of using Rust for scripting is bizaar. I can understand not wanting to use Python for everything, but I see the problem being the 'use it for everything' not the language choice. Use the tool that excels at the job. There is no language that is good at everything.
- natsucks 2y agoRust is cool now. Python is not cool anymore.
- steve1977 2y agoI think Python fell victim to the Peter Principle. It got promoted beyond its competence.
- germandiago 2y agoPython does well for several reasons. Some that come to my mind: its versatility binding native code and its easy-to-fit in your brain mental model for many tasks. The fact that you can script with Python without a compilation step also helped a lot to spread its popularity I think.
- rightbyte 2y agoThe way you define the entry point function is so bizarre I assume scripting was the original use case.
- germandiago 2y agoCould be. But it also gives you the flexibility to set tests inside the module files.
- AnimalMuppet 2y agoHaving to use the wrong tool is not cool, ever. So I don't care how cool Rust is right now, I still am not going to use it for scripting.
- weinzierl 2y agoHave you tried it? How would you know that Rust is the wrong tool. I'm indifferent when it comes to Python vs Rust for scripting, but I'd take Rust over a shell script (of any variety) any day.
- AnimalMuppet 2y agoThere are many things I have not tried, ranging from Rust to heroin. "You don't know because you haven't tried it" is really bad epistemology. It's also totally impractical. Rust isn't the only language I haven't tried; there are more than a thousand of them. I'm not using JOVIAL for scripting, or Fortran, or a bunch of others. No, I haven't tried any of those either. No, I'm not going to. Turning specifically to Rust, I don't use it for scripting because it's not what I look for in a scripting language. It's compiled; I look for a language that doesn't have that extra step. It has the borrow checker; I don't write scripting code that needs that level of discipline and care. In fact, most of my scripting is of the form "pick some bits out of a text file". For that, Perl is my tool of choice. Sure, other languages have regexes. None of them do it as cleanly and simply as Perl. (Note well: "clean" does not apply to the Perl syntax...)
- smallstepforman 2y agoThe current project I’m working on has tons of resource caches (for performance), with tons of non-owning pointers sharing cache references. I’d hate to do this in opinionated languages like Rust.
- n_plus_1_acc 2y agocargo -Zscript is in nightly
- weinzierl 2y ago> The idea of using Rust for scripting is bizaar. Not at all, I do the same.
- steveklabnik 2y agoIncidentally, this thing comes up a lot: Python vs Rust for scripts. I wrote a comparison four years ago: https://news.ycombinator.com/item?id=22712441 https://news.ycombinator.com/item?id=22712441 And updated it six months later: https://news.ycombinator.com/item?id=24595081 https://news.ycombinator.com/item?id=24595081 That's still how I'd do this task today. Anyway, I don't think that Rust is always a great choice for scripting, but if you already know Rust, it's totally fine at it.
- germandiago 2y agoSame for C++ with a good options library and std::filesystem IMHO. You can kind of script with that. I did it and was surprised it did well for some of my engine tooling.
- e44858 2y agoFor a single file script, you can avoid managing environments by using a nix shebang: https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/python.section.md#running-python-scripts-and-using-nix-shell-as-shebang-running-python-scripts-and-using-nix-shell-as-shebang https://github.com/NixOS/nixpkgs/blob/master/doc/languages-f...
- IshKebab 2y agoSame for me. Mainly due to the packaging fiasco (and to a lesser extent, imports). The actual language is not awful. Some features are even nice, like infinite precision integers by default, and separate / and // operators. Language is ok. Setting everything up is atrocious. The other quite annoying thing is that the docs are extremely badly organised so Google rarely points you directly at what you want. Instead you get stuff like w3schools which is trash, but much better organised. Also annoying that the docs still don't include types. I would use Typescript (via Deno), Go or Rust instead. There are some other Python replacement languages I haven't tried yet that might be an option like Mojo, Lobster, Nim. Probably still too niche for production; I'd stick with Typescript.
- emmanueloga_ 2y agoPixi.sh has been great for me so far, it’s a single binary install that can install Python, conda packages and PyPi packages, maybe give it try!
- IshKebab 2y agoLooks nice but I can't really require the whole team of like 100 people to use this quite niche tool. Python needs an official solution.
- dlahoda 2y agopoetry with poetry2nix with nix flakes will do magic in terms of setup. if stick with pyright(inference) it is as modern as rust. python speed increases heavily in all directions.
- IshKebab 2y ago> poetry with poetry2nix with nix flakes will do magic in terms of setup. I'm sure, but it also sounds like it will take about 2 weeks of reading manuals and learning Nix before I'll get to the same point as Rust and Go start at. And that's not really an option for big teams, which is the only situation where I'm forced to use Python anyway.
- xedrac 2y agoBecause Python falls all over itself in larger projects, and is poor at utilizing resources efficiently. It's fine for smaller things that don't care about cpu cycles. I would much rather use Rust in a large project.
- DrBazza 2y agoAny non-trivial python is indistinguishable from magic.