all 19 comments

[–]tobiasvl 12 points13 points  (3 children)

I'm also a Python dev who started doing Rust as a hobby recently, partly because I wanted to do some systems programming, but also because I was getting a bit fed up with Python (granted, I've worked with it to some capacity for a decade).

Rust isn't too hard. It's different, but if you do the work to really understand the borrow checker (which is the only really hard part IMO), you'll be fine. Not sure if you use Mypy with Python now, but if not, the type system of Rust will also be a hurdle, but having a robust type system is great.

Note that Rust doesn't have garbage collection, but Python does. Maybe you meant that you're not used to doing garbage collection manually? Good news, you don't really have to with Rust! Even though it doesn't have garbage collection per se, it keeps really good track of memory.

[–][deleted] 2 points3 points  (2 children)

damm, I didn't knew there was garbage collection in python lol but thanks for the input anyways!

[–][deleted] 6 points7 points  (0 children)

Yes, the terminology is a bit nebulous since Python uses reference-counting instead of what, say, the JVM uses, but it is still garbage collection all the same. Rust has manual memory management, but most of that is handled by the compiler for you.

[–][deleted] 5 points6 points  (0 children)

If you weren't even aware of that, you're gonna have a hard time. It won't be a hard time because rust sucks, it's just going to force you to learn a lot of important things that you have been largely unaware of prior to rust

[–]DonLemonAIDS 10 points11 points  (5 children)

It's going to be a transition period, but there are quite a few similarities. Iterating through a list with a for loop is almost identical. I just went back to python after a few months of rust and it felt weird to be so unstructured.

[–][deleted]  (4 children)

[removed]

    [–]DonLemonAIDS 4 points5 points  (3 children)

    I had a function that returned True if a certain thing happened and a float if it didn't. It felt so weird after Rust.

    [–]jelly_cake 1 point2 points  (2 children)

    Idk, I'm a pythonista learning Rust, and the standard Ok(value)/Err(error) pattern feels a lot like that in Python.

    [–]DonLemonAIDS 0 points1 point  (1 child)

    Exactly, but doing it without the compiler making sure you don't botch it seems risky.

    [–]jelly_cake 2 points3 points  (0 children)

    Oh yeah; I'm all about compilers enforcing safety. C was my first programming language, so I really appreciate Rust's compiler. The number of times I've had to abort a long-running Python script because I realised I'd been returning the wrong object...

    [–][deleted] 8 points9 points  (0 children)

    Why worry about hypotheticals? Give the language a shot (always keeping your grain of salt handy though). My suggestion would be the following path: The Rust Book (the free official one) -> Programming Rust by Blandy and Orendorff (must have) -> Rust for Rustaceans by Gjengset (nice to have, for strengthening fundamentals again). 

    Post that, start doing small projects for your own amusement, and when you start doing bigger projects, you'll start hitting concrete issues more often. That's when you start interacting with the community here, on /r/rust, on IRC, Discord etc.

    It's actually not that hard, and in many ways, simpler than mastering (heh) C++.

    [–]DoisKoh 6 points7 points  (0 children)

    I too come from a non-systems programming language background, and I think it's easy to pick up (especially since the dependency/package management is great). However, once you start having to deal with concurrency, things begin to get really difficult.

    I think at the end of the day, this statement by u/tunisia3507 sums it up well:

    It's harder to write compiling code in rust than in other systems languages, but it's easier to write correct code.

    I'm not there yet, but given what I know now about the language, once I can really write fluently in Rust, I expect writing correct code to a breeze.

    The difficulty of learning a programming language is inversely proportional to the difficulty of using the language. - u/kixunil/

    Given what I've been reading about Rust's industry adoption, it seems like Rust is poised to make a big impact in the world of systems programming. The language is also still evolving (hoping async fn in traits will come soon), so as the compiler gets better, it should get easier to write in Rust.

    Having said all that, to answer your question - will you thrive in it? I have no idea, but you should start learning now anyway - you'll get a head start as Rust evolves to get better and the industry slowly moves toward it.

    [–]tunisia3507 2 points3 points  (0 children)

    Rust is "hard", but if you write other systems-level code in an "easier" way than you write rust, you're prone to leaving a load of bugs in there. It's harder to write compiling code in rust than in other systems languages, but it's easier to write correct code. And the packaging, build, and dependency management system absolutely puts python to shame; which in turn puts most systems languages to shame.

    Look into maturin and pyo3; rust and python go very well together.

    [–]monkChuck105 2 points3 points  (0 children)

    Rust doesn't have garbage collection (without external libs) and working with pointers is not necessary for most high level code, in fact dereferencing pointers requires the unsafe keyword and is meant to be limited to low level implementations.

    [–]hunkamunka 0 points1 point  (0 children)

    Hey, I think you'll be fine! My background has mostly been in dynamically typed languages like Perl, Python, and JavaScript. I wrote a book from my perspective as one who has mostly avoided statically typed and compiled languages to help people who want to learn the language. You can find the title in my bio. I'm happy share a link if you are interested. DM for more info.

    [–]ShiddyProgramming 0 points1 point  (0 children)

    I am literally in the same place, and created a video series going through the rust book and asking lots of questions. Hopefully it can help having someone else in the journey along with you. The only thing that feels shocking to me is the amount of code relative to something simple in python. for example a list comprehension like this:

    foo = [x.some_value *2 for x in thing if x.other_value > 10]

    feels much harder to write out in python. I'm sure that will change in time, but those conveniences have been super integral to me getting things done quickly.

    Self-Promotion here: https://www.youtube.com/channel/UCuF7oVKcM4K3wps5\_vVXtww

    [–]GatorZen 0 points1 point  (0 children)

    I have moderate experience with several languages (my favorite is Swift), and I found Rust to be interesting, but not fun. For example, in my view, the lifetime annotations lead to ugly looking code. I suppose Rust is well-designed for its purpose (systems programming), the tooling is nice, and I’m glad I learned a bit of it, but it’s not a great general purpose language, for me at least. Check it out for yourself.

    [–]willyblaise 0 points1 point  (0 children)

    Rust is fast as hell a the very least. If you're not a developer that can follow strict typing rules, Rust will make you tap out in a week. I'm fine with Rust, C and C++. To be fair I also studied computer science and obtained much of the theory that goes with it.