PEP 484 – Type Hints - Python Enhancement Proposals
A type variable used in a generic function could be inferred to represent different types in the same code block. Example: from typing import TypeVar ...
A type variable used in a generic function could be inferred to represent different types in the same code block. Example: from typing import TypeVar ...
Feb 27, 2026 ... (Example code for implementing this below.) More powerful decorator typing. The typing of decorator functions has long been a pain point in ...
This PEP specifies an improved syntax for specifying type parameters within a generic class, function, or type alias. It also introduces a new statement for declaring type aliases.
Jul 13, 2000 ... This PEP contains the index of all Python Enhancement Proposals, known as PEPs. PEP numbers are assigned by the PEP editors, ...
Tokenizer modifications. async/await. Reference Implementation. List of high-level changes and new protocols. Working example.
PEP 484 introduced type hints, a.k.a. type annotations. While its main focus was function annotations, it also introduced the notion of type comments to ...
Examples. Example: Forwarding an asynchronous result. Example: Keeping state across an await. Example: Handling a timeout. Example: Scheduling a dependent read. Example: Acquiring an async lock for native work. Reference Implementation. Rejected Ideas.
Feb 1, 2025 ... For example, consider the following function which converts a batch [1] of videos to grayscale: def to_gray(videos: Array): .
For instance, once Python has a JavaScript foreign function interface, it will be possible to support urllib on Emscripten. Downstream, supporting urllib3, aiohttp, httpx, matplotlib, bokeh, and other projects that do I/O requires the foreign function interface.
May 1, 2007 ... Client code can now verify that an incoming object performs the Doglike role, allowing it to handle Wolf , LaughingHyena and Aibo [1] instances, ...
We believe that adding pattern matching to Python will enable Python users to write cleaner, more readable code for examples like those above, and many ...