Ask Lemmy
A Fediverse community for open-ended, thought provoking questions
Please don't post about US Politics. If you need to do this, try !politicaldiscussion@lemmy.world
Rules: (interactive)
1) Be nice and; have fun
Doxxing, trolling, sealioning, racism, and toxicity are not welcomed in AskLemmy. Remember what your mother said: if you can't say something nice, don't say anything at all. In addition, the site-wide Lemmy.world terms of service also apply here. Please familiarize yourself with them
2) All posts must end with a '?'
This is sort of like Jeopardy. Please phrase all post titles in the form of a proper question ending with ?
3) No spam
Please do not flood the community with nonsense. Actual suspected spammers will be banned on site. No astroturfing.
4) NSFW is okay, within reason
Just remember to tag posts with either a content warning or a [NSFW] tag. Overtly sexual posts are not allowed, please direct them to either !asklemmyafterdark@lemmy.world or !asklemmynsfw@lemmynsfw.com.
NSFW comments should be restricted to posts tagged [NSFW].
5) This is not a support community.
It is not a place for 'how do I?', type questions.
If you have any questions regarding the site itself or would like to report a community, please direct them to Lemmy.world Support or email info@lemmy.world. For other questions check our partnered communities list, or use the search function.
Reminder: The terms of service apply here too.
Partnered Communities:
Logo design credit goes to: tubbadu
view the rest of the comments
I mean, they are very different languages. Python is an interpreted, dynamically-typed language that is known to be quite slow. Rust is basically the opposite; a natively compiled, strongly typed language.
I would say Python really is a scripting language and you shouldn't use it for more than that - small scripts is where it shines, because you can get something running quickly and you probably don't care if it's super reliable or maintainable. And as long as the scripts are small, they are automatically easy to change because they're small. Problem is that Python is "easy to learn" so lots of people know it so lots of companies use it. This leads to lots of problems if you ask me. Python is easy to learn, but that's only because Python does basically nothing to help you create a proper, reliable and nicely structured program.
Rust is hard to learn, but it pushes you towards much better habits and it forces you to build better programs. These benefits feel cumbersome in the start, especially when you're learning and you're building small programs. Small programs is not when these benefits really start kicking in.
However, if you are working on a large system, the difference between Python and Rust is insane. Rust will help you so much. You change 1 line out of 1 million lines and Rust will tell you exactly where your change breaks other code, which will lead you to fix those other places. Meanwhile, if you change 1 of 1 million lines in Python, you need to pray that there are tests that catch whatever problems your change may have caused (spoiler: there probably aren't).
So in my opinion, if you are doing serious professional software engineering for an employer where you are not the only one working on the code... Rust just provides so much more stability and reliability than Python.
You might be interested in Polars, which is kinda a successor to Pandas written in Rust (can also be used from Python).
I will take a look at Polaris. I started out in C and C++ years ago, so I all no stranger to strong typing. The Python devs have realized that there needs to be ways to add strong typing, so you can now explicitly type inputs and outputs to functions, which helps a lot. Also, there are places where other companies have implemented things in Python, so you are somewhat pigeonholed into using Python or reverting back to the C++ SDK for them, which can be a nightmare in its own right. Lucky for me I am the only one really touching the code I am working on and it is all bespoke, but someone will need to maintain it later so I have been taking to the strong typing in my recent work.
I will have to take a look at Rust some more and see how it feels. Thanks for the analysis.
If you're familiar with C++ and C, Rust should be easy to learn. It's basically just enforcing all the stuff you shouldn't do in C/C++ - double free, too early free (dangling pointers), reading and writing to stuff from two different threads at the same time (data race). And at the same time modernizing the whole experience (actually useful compiler error messages, easy and convenient dependencies that "just work" without having to worry about a build system, in-built test system, etc.)
Ooo, that all sounds kinda sexy. I may have fun.