Guide¶
The guide teaches the core of the language. It opens with a one-page map of the differences from Python; the pages after it build up the model behind them. Types are static, and the type of a value decides how it is stored in memory. Fields, containers, and globals own the values stored in them, while local variables and parameters alias objects exactly as in Python. Efficient TurboPython is mostly ordinary Python code, with a few constraints added where performance matters.
Readers new to TurboPython can start with Getting started, which installs the compiler and gives a ten-minute tour of the language.
The pages, in reading order¶
- How TurboPython differs from Python — a one-page map of the language: the model and the main differences from Python, with the diagnostics the compiler prints for them.
- Types, inference and values —
intand the fixed-width number types, what literals infer, value types against reference types, optionals, and the three string types. - Functions and API boundaries — what an annotated signature promises, how arguments and return values cross the boundary, and how to design a small typed API.
- Ownership and references — the most detailed page: which storage owns its values, how borrowing works, and when a store moves or copies.
- Data modeling — classes, protocols, containers,
and unions with
match, and where method dispatch differs from Python. - Control flow, None & errors — narrowing
Noneaway, exceptions and what they cost, and writing iterators. - Writing efficient TPy — the closing checklist: fixed-width arithmetic, deliberate copies, borrowing, and the constraint decorators.
- Building & running — running programs, the REPL, standalone binaries, the generated C++, and CPython extensions.
- Coming from C++/Rust — how the model maps onto C++ and Rust concepts; Python readers can skip it.
- Beyond the core — the current state of async, threads, generators, protocols, and native interop.
Compatibility tracks the exact status of language features and the standard library.