Pragmatic AI Labs

OO: Python to Rust

Cyber Monday: Ends tomorrow! Lock in Coursera Plus for $239/year and build skills all year.

Pragmatic AI Labs

OO: Python to Rust

This course is part of multiple programs.

Noah Gift
Alfredo Deza

Instructors: Noah Gift

Included with Coursera PlusLearn more

Gain insight into a topic and learn the fundamentals.
Intermediate level

Recommended experience

6 hours to complete
Flexible schedule
Learn at your own pace
Gain insight into a topic and learn the fundamentals.
Intermediate level

Recommended experience

6 hours to complete
Flexible schedule
Learn at your own pace

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.

Details to know

Shareable certificate

Add to your LinkedIn profile

Assessments

1 assignment

Taught in English

Build your subject-matter expertise

This course is available as part of
When you enroll in this course, you'll also be asked to select a specific program.
  • 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

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

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

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

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

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

Earn a career certificate

Add this credential to your LinkedIn profile, resume, or CV. Share it on social media and in your performance review.

Instructors

Noah Gift
Pragmatic AI Labs
90 Courses16,652 learners
Alfredo Deza
Pragmatic AI Labs
84 Courses11,522 learners

Offered by

What brings you to Coursera today?

  • cplus logo

    Ends tomorrow! Cyber Monday savings on a year of skills

    CyberMonday-Ends Soon
  • Coursera for Teams

    Gift your team new skills

Why people choose Coursera for their career

Felipe M.

Learner since 2018
"To be able to take courses at my own pace and rhythm has been an amazing experience. I can learn whenever it fits my schedule and mood."

Jennifer J.

Learner since 2020
"I directly applied the concepts and skills I learned from my courses to an exciting new project at work."

Larry W.

Learner since 2021
"When I need courses on topics that my university doesn't offer, Coursera is one of the best places to go."

Chaitanya A.

"Learning isn't just about being better at your job: it's so much more than that. Coursera allows me to learn without limits."

Frequently asked questions