Pragmatic AI Labs

OO: Python to Rust

Pragmatic AI Labs

OO: Python to Rust

本课程是 Rust for Data Engineering 专项课程 的一部分

Noah Gift

位教师:Noah Gift

访问权限由 Coursera Learning Team 提供

深入了解一个主题并学习基础知识。
中级 等级

推荐体验

6 小时 完成
灵活的计划
自行安排学习进度
深入了解一个主题并学习基础知识。
中级 等级

推荐体验

6 小时 完成
灵活的计划
自行安排学习进度

您将学到什么

  • 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.

要了解的详细信息

可分享的证书

添加到您的领英档案

作业

1 项作业

授课语言:英语(English)
最近已更新!

May 2026

了解顶级公司的员工如何掌握热门技能

Petrobras, TATA, Danone, Capgemini, P&G 和 L'Oreal 的徽标

积累特定领域的专业知识

本课程是 Rust for Data Engineering 专项课程 专项课程的一部分
在注册此课程时,您还会同时注册此专项课程。
  • 向行业专家学习新概念
  • 获得对主题或工具的基础理解
  • 通过实践项目培养工作相关技能
  • 获得可共享的职业证书

该课程共有5个模块

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.

涵盖的内容

3个视频7篇阅读材料

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.

涵盖的内容

3个视频6篇阅读材料

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.

涵盖的内容

3个视频6篇阅读材料

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.

涵盖的内容

3个视频6篇阅读材料

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.

涵盖的内容

2个视频6篇阅读材料1个作业

获得职业证书

将此证书添加到您的 LinkedIn 个人资料、简历或履历中。在社交媒体和绩效考核中分享。

位教师

Noah Gift
Pragmatic AI Labs
58 门课程3,861 名学生

提供方

Pragmatic AI Labs

人们为什么选择 Coursera 来帮助自己实现职业发展

Felipe M.

自 2018开始学习的学生
''能够按照自己的速度和节奏学习课程是一次很棒的经历。只要符合自己的时间表和心情,我就可以学习。'

Jennifer J.

自 2020开始学习的学生
''我直接将从课程中学到的概念和技能应用到一个令人兴奋的新工作项目中。'

Larry W.

自 2021开始学习的学生
''如果我的大学不提供我需要的主题课程,Coursera 便是最好的去处之一。'

Chaitanya A.

''学习不仅仅是在工作中做的更好:它远不止于此。Coursera 让我无限制地学习。'

从 Computer Science 浏览更多内容