Introduction – Rust for Python Programmers
Source: Hacker News
Keyboard shortcuts
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
Rust for Python Programmers: Complete Training Guide
A comprehensive guide to learning Rust for developers with Python experience. This guide covers everything from basic syntax to advanced patterns, focusing on the conceptual shifts required when moving from a dynamically-typed, garbage-collected language to a statically-typed systems language with compile-time memory safety.
How to Use This Book
Self-study format: Work through Part I (ch 1–6) first — these map closely to Python concepts you already know. Part II (ch 7–12) introduces Rust-specific ideas like ownership and traits. Part III (ch 13–16) covers advanced topics and migration.
Pacing recommendations:
ChaptersTopicSuggested TimeCheckpoint
1–4Setup, types, control flow1 dayYou can write a CLI temperature converter in Rust
5–6Data structures, enums, pattern matching1–2 daysYou can define an enum with data and match exhaustively on it
7Ownership and borrowing1–2 daysYou can explain why let s2 = s1 invalidates s1
8–9Modules, error handling1 dayYou can create a multi-file project that propagates errors with ?
10–12Traits, generics, closures, iterators1–2 daysYou can translate a list comprehension to an iterator chain
13Concurrency1 dayYou can write a thread-safe counter with Arc>
14Unsafe, PyO3, testing1 dayYou can call a Rust function from Python via PyO3
15–16Migration, best practicesAt your own paceReference material — consult as you write real code
17Capstone project2–3 daysBuild a complete CLI app tying everything together
How to use the exercises:
-
Chapters include hands-on exercises in collapsible “ blocks with solutions
-
Always try the exercise before expanding the solution. Struggling with the borrow checker is part of learning — the compiler’s error messages are your teacher
-
If you’re stuck for more than 15 minutes, expand the solution, study it, then close it and try again from scratch
-
The Rust Playground lets you run code without a local install
Difficulty indicators:
-
🟢 Beginner — Direct translation from Python concepts
-
🟡 Intermediate — Requires understanding ownership or traits
-
🔴 Advanced — Lifetimes, async internals, or unsafe code
When you hit a wall:
-
Read the compiler error message carefully — Rust’s errors are exceptionally helpful
-
Re-read the relevant section; concepts like ownership (ch7) often click on the second pass
-
The Rust standard library docs are excellent — search for any type or method
-
For deeper async patterns, see the companion Async Rust Training