typing
typing copied to clipboard
Python static typing home. Hosts the documentation and a user help forum.
The current scoping rules for type variables seems to deny type annotations over generic functions. ## The issue define two functions as follows: ``` def fx_1(f: Callable[[bool], int]) -> int:...
Currently it seems impossible to have async `TypeGuard` or `TypeIs`: ```python from typing_extensions import TypeIs async def foo(a: int | str) -> TypeIs[int]: raise NotImplementedError async def main() -> None:...
This request is a combination of two additions to `ByteString` that apparently are not supported yet, or at least I could find no discussion of them. - Support any bytes-like...
The wonderfully useful [specification of type annotation expressions](https://typing.readthedocs.io/en/latest/spec/annotations.html#type-and-annotation-expressions) describes what kinds of expressions are valid type annotations. I believe the spec does not include a case which type checkers support,...
The conformance test `directives_type_ignore` feels a bit weird since it disallows the Mypy syntax: ``` z: int = "" # type: ignore[] # It has the following line where the...
# Documentation The official typing documentation recommends using a `setup.py` without `pyproject.toml` (https://typing.python.org/en/latest/guides/libraries.html#companion-type-stub-package, `Doc/library/typing.rst`). This relies on pre-PEP 621 fallback behavior, while we should teach users to follow PEP 621...
Type checkers and `typeshed` special case `NotImplemented` to be treated as `Any`, this [appears to be not documented](https://typing.python.org/en/latest/search.html?q=NotImplemented) in the spec currently. A small paragraph should probably go here: https://typing.python.org/en/latest/spec/special-types.html
Reading through https://typing.python.org/en/latest/spec/distributing.html#partial-stub-packages today for unrelated purposes, it struck me that the occurrences of `partial\n` are ambiguous because it could be interpreted as requiring literally a backslash and an n....
I've bumped into one of the largest and most frustrating puzzles I've ever encountered but I wanted to understand what the thought process behind ParamSpec was for class functions because...