PyO3: Rust 💚 Python
summary
Implements a Rust counter that checks whether a character appears at least N times with optional newline and space resets, exposes it to Python as a pyclass with a constructor and a has_count method, and uses PyO3 annotations so no separate glue code is needed. Development uses maturin (maturin develop) and produces CPU-specific wheels with maturin build. Code runs, is memory‑safe, and is significantly faster than a pure Python equivalent while remaining zero‑cost in abstractions.
AI-written summary · about
chapters (8)
- 0:00PyO3 and Rust intro
- 0:54Why Rust is useful
- 2:19Counting characters example
- 4:50Rust counting logic
- 8:01Wrapping Rust with PyO3
- 10:55Building Python module
- 12:42Testing PyO3 module
- 13:45Python and Rust benefits
related talks
28m"Python ‹3 Rust"
44mHow Python Harnesses Rust through PyO3
44mDo Pythons Rust? How we used PyO3 to build a Python Stream Processor w/ a Rust Heart
03h 19mPyO3 101 - Writing Python modules in Rust
46mPython + Rust = ?
34mRust for the Python dev
01h 07m🐍 Python meets the crab 🦀 - Friendship at first sight?
35mUsing Rust to write Python modules
