Welcome to Typing Specification’s documentation!#
- The Python Type System
- Type system concepts
- Type annotations
- Special types in annotations
- Generics
- Type qualifiers
- Class type compatibility
- Type aliases
- Literals
- Protocols
- Terminology
- Defining a protocol
- Protocol members
- Explicitly declaring implementation
- Merging and extending protocols
- Generic protocols
- Recursive protocols
- Self-types in protocols
- Subtyping relationships with other types
- Unions and intersections of protocols
Type[]
and class objects vs protocolsNewType()
and type aliases- Modules as implementations of protocols
@runtime_checkable
decorator and narrowing types byisinstance()
- Callables
@overload
- Dataclasses
- Typed dictionaries
- Type narrowing
- Type checker directives
- Distributing type information
- Historical and deprecated features