OO: Python to Rust
Keep adding new skills with 10,000+ programs for $239 (usually $399). Save now.
OO: Python to Rust
This course is part of Rust for Data Engineering Specialization
Instructor: Noah Gift
Included with
Learn more
Ask Coursera
Recommended experience
Recommended experience
What you'll learn
Apply a receipt-driven, three-mode workflow (Discover, Refactor, Translate) to move object-oriented Python code into idiomatic Rust.
Translate Python class hierarchies into Rust structs, traits, enums, and the type-state pattern using composition over inheritance.
Score Python-to-Rust translation pull requests using a breakeven analysis and complexity-claim review rubric.
Skills you'll gain
Tools you'll learn
Details to know
May 2026
1 assignment
See how employees at top companies are mastering in-demand skills
Build your subject-matter expertise
- Learn new concepts from industry experts
- Gain a foundational understanding of a subject or tool
- Develop job-relevant skills with hands-on projects
- Earn a shareable career certificate
There are 5 modules in this course
OO: Python to Rust is a hands-on course on object-oriented design for engineers moving from Python (a class-based, dynamic OO language) to Rust (a struct-and-trait-based language with no inheritance and strict ownership). You will learn how Rust models the four classical OO pillars - encapsulation, abstraction, polymorphism, and code reuse - without classes or inheritance, using structs, methods (impl blocks), traits, trait objects, generics, enums, and the type state pattern. The course translates common Python OO patterns (dataclasses, dunder methods, ABCs, mixins, descriptors, protocols, the singleton, factory, observer, strategy, and decorator patterns) into idiomatic Rust, and explains why some of them simply don't apply once you have algebraic data types and ownership. You will refactor a non-trivial Python OO codebase into Rust, learn when composition beats inheritance, when an enum beats a class hierarchy, and how to design APIs that leverage Rust's compile-time guarantees. By the end of the course, you will be able to read OO Python code and produce a correct, idiomatic Rust translation, and justify your design decisions on a code review. Part of the Rust for Data Engineering specialization.
Every Big-O claim in this course ships with three independent receipts: an EMPIRICAL bench (criterion measures the curve), a STRUCTURAL guard (Rust types and proptest enforce it), and a FORMAL theorem (Lean 4 machine-checked, displayed as a [verified] stamp). Complexity is a CLAIM about how runtime or memory scales with input size. In this module you learn the c24 workflow: write the claim as a contract, bind it to your Rust pub item, then attach the three receipts. A CLAIM of O(N) survives only if the slope on a log-log plot stays linear from N=10 to N=1,000,000.
What's included
3 videos7 readings
3 videosβ’Total 4 minutes
- What "Complexity" Means + Three Modes of Proofβ’1 minute
- Reading a Complexity Claim - Falsifiabilityβ’1 minute
- Depyler - the Transpiler Shortcutβ’1 minute
7 readingsβ’Total 70 minutes
- About This Courseβ’10 minutes
- Key Terms: What "Complexity" Means + Three Modes of Proofβ’10 minutes
- Reflection: What "Complexity" Means + Three Modes of Proofβ’10 minutes
- Key Terms: Reading a Complexity Claim - Falsifiabilityβ’10 minutes
- Reflection: Reading a Complexity Claim - Falsifiabilityβ’10 minutes
- Key Terms: Depyler - the Transpiler Shortcutβ’10 minutes
- Reflection: Depyler - the Transpiler Shortcutβ’10 minutes
In this module you will master Empirical Wins β the speedups you can measure with cargo bench. You will translate three Python patterns to Rust idioms that drop runtime and memory: list comprehensions become fused iterator chains (filter+map in one pass, O(1) memory vs O(N)); x in dict becomes HashMap::contains_key with hasher choice as a c24 receipt (FxHash, AHash, or default SipHash, each measured); and sorted() becomes sort_unstable for cases where stability is not required. Every claim ships with criterion HTML reports as the EMPIRICAL receipt, a STRUCTURAL guard from Rust's type system, and a [verified] stamp from a FORMAL theorem.
What's included
3 videos6 readings
3 videosβ’Total 4 minutes
- From Python List Comprehensions to Rust Iterator Chainsβ’1 minute
- From Python Dict Lookup to Rust HashMapβ’1 minute
- From Python sorted() to Rust sort_unstableβ’1 minute
6 readingsβ’Total 60 minutes
- Key Terms: List Comprehension β Iteratorβ’10 minutes
- Reflection: List Comprehension β Iteratorβ’10 minutes
- Key Terms: x in dict β HashMap Lookupβ’10 minutes
- Reflection: x in dict β HashMap Lookupβ’10 minutes
- Key Terms: sorted() β sort_unstableβ’10 minutes
- Reflection: sorted() β sort_unstableβ’10 minutes
Python Optional[T] becomes Rust Option<T> with proptest sweeping every combinator chain; Python try/except becomes Result<T, E> with @semantic: total promoting every fallible function β the structural receipt that makes silent failure impossible.
What's included
3 videos6 readings
3 videosβ’Total 3 minutes
- From Python Optional to Rust Optionβ’1 minute
- From Python try/except to Rust Resultβ’1 minute
- From Python Mutable Default to Rust Ownershipβ’1 minute
6 readingsβ’Total 60 minutes
- Key Terms: Optional[T] β Option<T>β’10 minutes
- Reflection: Optional[T] β Option<T>β’10 minutes
- Key Terms: try/except β Result<T, E>β’10 minutes
- Reflection: try/except β Result<T, E>β’10 minutes
- Key Terms: Mutable Default Arg β Ownershipβ’10 minutes
- Reflection: Mutable Default Arg β Ownershipβ’10 minutes
Systems-level translation makes the runtime trade-off visible. Python generators allocate per-call frame state and pay GIL overhead; Rust Iterator is monomorphized into the caller's stack β the structural receipt is the criterion bench showing a ~50x tight-loop gap. subprocess.run with sh -c re-introduces CWE-78 shell injection; Command::new().arg() invokes execve directly and removes the attack surface entirely. threading on CPython is serialized by the GIL; rayon::par_iter() distributes work across all cores via a Send + Sync work-stealing scheduler whose data-race bugs are compile errors. Each translation in this module is a runtime claim with a measurable receipt.
What's included
3 videos6 readings
3 videosβ’Total 3 minutes
- From Python yield Generator to Rust Iteratorβ’1 minute
- From Python subprocess to Rust Commandβ’1 minute
- From Python threading to Rust rayon Parallel Iteratorβ’1 minute
6 readingsβ’Total 60 minutes
- Key Terms: Python generator β Rust Iteratorβ’10 minutes
- Reflection: Python generator β Rust Iteratorβ’10 minutes
- Key Terms: subprocess β Commandβ’10 minutes
- Reflection: Exhaustive Match as a Completeness Receiptβ’10 minutes
- Key Terms: threading β rayon Parallel Iteratorβ’10 minutes
- Reflection: When to Pick ADT vs Traitβ’10 minutes
The capstone closes the loop with a five-step playbook β transpile, inspect, refine, bench, prove β that you can apply to any hot Python loop and ship a receipt-backed Rust translation. Every Pull Request lands four receipts: criterion HTML report, proptest run, contract pv check, and a Lean status: proved stamp. The second lesson is the inverse: when the receipt-driven math says keep Python. Breakeven analysis, BREAKEVEN.md, and a final graded quiz that synthesizes Modules 1β5.
What's included
2 videos6 readings1 assignment
2 videosβ’Total 2 minutes
- The Three-Mode Playbook End to Endβ’1 minute
- When NOT to Translateβ’1 minute
6 readingsβ’Total 60 minutes
- Key Terms: The Three-Mode Playbook End to Endβ’10 minutes
- Reflection: The Three-Mode Playbook End to Endβ’10 minutes
- Key Terms: When NOT to Translateβ’10 minutes
- Reflection: When NOT to Translateβ’10 minutes
- Before You Goβ’10 minutes
- Next Stepsβ’10 minutes
1 assignmentβ’Total 30 minutes
- Final Graded Quiz: Big-O from Python to Rustβ’30 minutes
Earn a career certificate
Add this credential to your LinkedIn profile, resume, or CV. Share it on social media and in your performance review.
Instructor
Offered by
Explore more from Software Development
- Status: Free TrialP
Pragmatic AI Labs
Course
- Status: Free TrialD
Duke University
Course
- Status: Free TrialP
Pragmatic AI Labs
Course
Why people choose Coursera for their career
Frequently asked questions
To access the course materials, assignments and to earn a Certificate, you will need to purchase the Certificate experience when you enroll in a course. You can try a Free Trial instead, or apply for Financial Aid. The course may offer 'Full Course, No Certificate' instead. This option lets you see all course materials, submit required assessments, and get a final grade. This also means that you will not be able to purchase a Certificate experience.
When you enroll in the course, you get access to all of the courses in the Specialization, and you earn a certificate when you complete the work. Your electronic Certificate will be added to your Accomplishments page - from there, you can print your Certificate or add it to your LinkedIn profile.
Yes. In select learning programs, you can apply for financial aid or a scholarship if you canβt afford the enrollment fee. If fin aid or scholarship is available for your learning program selection, youβll find a link to apply on the description page.
More questions
Financial aid available,
