Skip to content

Language reference

Each page covers one area of the TyPy specification: what TyPy 0.5 accepts, with the rule ID of each item, what it refuses, and what later releases add. The rule IDs are the ones diagnostics name, such as TYP-03.

Page Area Rules
Standard Python Which programs TyPy accepts, and the promise it makes about them STD
Lexical structure Literals, comments and indentation LEX
Types and annotations Annotations, inference and narrowing TYP
Expressions Operators, comparisons, comprehensions and calls EXP
Simple statements Assignment, unpacking, pass, return, break and continue SMT
Compound statements if, while, for and match CST
Functions Function definitions and recursion FUN
Classes Classes, attributes, methods and type objects CLS
Generics Type parameters and protocols GEN
Modules Imports, packages and lazy imports MOD
Memory Reference counting, value layout and the allocator MEM

The other areas of the specification have their pages in the other sections of this documentation:

Page Area Rules
Built-in types int, float, str, bytes, lists, tuples, dicts and sets DAT
Exceptions Raising, catching and with EXC
Built-in functions and modules Builtins, methods of the built-in types, math, sys and files LIB
Command line typy check, build and run, and typy.toml CLI
C interoperability ctypes, and modules built as C libraries FFI
Diagnostics How TyPy reports a problem DIA