Can any suggest me a path to teach python users rust-lang?


I’m trying to preach Rust to some python users, who knows a little C. The reason why they may be interested in Rust is the efficiency, which is poor for python. So I’m thinking I may persuade them to give Rust a try.

It is ok to learn Rust through the book, but the book may be organized in a logical order, rather than a natural way of learning. So can anyone suggest me a path to teach a python user?

In my opinion,
for a python user who knows a little C, following path may be suitable:

  1. Hello, world! to introduce the fundamental elements of a basic program;
  2. Basic cargo commands (new, build, and run);
  3. Variable binding: mutability.
  4. & and &mut
  5. if/while/loop/for (leave the iterator knowledge later)
  6. expression style (many things can be expressions)
  7. pattern match 1 (match, if let, while let)
  8. ordinary functions
  9. basic closure
  10. lifetime
  11. project organization (file/directory structure)
  12. struct/tuple
  13. Some basic knowledge about generic function and generic struct.
  14. Traits
  15. pattern match 2 (matching structs)

I’ll stop here and smart pointers, threads, macro implementing will not be touched at this step, for I think they can dig themselves given that above 15 points are taught.

At most 6 hours may be required to teach above 15 points.

Any suggestion? Thanks.


You can try going through The Rust Book and making examples more relevant to python users.


I could be wrong, but I feel like Rust is one of those languages that you might as well just learn from scratch. Sure, you can skip stuff here and there on loops, but there are so many things done differently that I’m not sure teaching someone coming from python would be much different than teaching someone coming from no language or any other language aside from the fact that pointers, references, and such will probably confuse the living hell out of them.

I’d tell them to first get a thorough understanding of C (not “a little C”… that doesn’t mean much, C isn’t a big language anyway).

To be honest with you, I don’t think it’s necessary to learn C first but for the fact that there simply aren’t a ton of Rust learning resources out there yet compared with C. One of the reasons I loved C and picked it up relatively quick was because for every book or video I couldn’t understand, there were hundreds of others… Sometimes one or even five different resources is not helpful for a given student. Rust isn’t at that level yet, so to understand about pointers and references, I think C is still helpful.

Now, C can also be confusing because Rust isn’t C and for example - a C programmer will probably see &something as “pass by reference” or pointer, when in reality, it is much easier to reason about stuff in Rust when you’re thinking about “pass by borrow or move” as opposed to “pass by reference or value.”

But even still, let’s face it - systems programming isn’t simple and there’s not many shortcuts, jumping from Python to C, C++, Rust, objective-C, etc is going to be considerable work no matter how a student goes about it. So in conclusion, I say just make a thorough Rust course… You could choose to have specific examples where you compare Python constructs with Rust’s but that may not be all that effective.

If I were you, I’d also focus on the strengths of Rust… Rust is strong for no runtime overhead (runtime performance), multithreading, and other low-level tasks… If you are having students learn the language by doing something that is best suited for Python, you’re just going to burn them out and make them hate Rust because it’s going to be more difficult (more compiler errors, etc…) with not much return on investment.

On the other hand, if you have them program a sweet concurrent application that does some data crunching faster than Python could, that would show off a real use-case for the language. Obviously, memory safety is a big one, but I doubt you’ll be building mission-critical applications in your course so it’s not as immediately appealing to newbies.


I just so happen to be porting a series of introductory Python exercises , written in a funcional way, to rust :

( The Python one Is in another of my Repos )


While striving to reach a very high performance in Python could be a waste of time, if you write Python code like you write something lower level like Java and then you use the PyPy JIT, you can often reach a decent performance. So if you want to learn Rust to write performant code, I think it’s a good idea to start teaching first how to avoid writing very slow code in Python.