typing
typing copied to clipboard
Python static typing home. Hosts the documentation and a user help forum.
Currently, the ["Version and platform checking" section](https://typing.readthedocs.io/en/latest/spec/directives.html#version-and-platform-checking) of the typing spec is very barebones. It basically says: > Type checkers are expected to understand simple version and platform checks. [...]...
This is an initial proposed draft of an expanded "type system concepts" document for the typing specification. It intends to improve clarity of the spec by giving definition to important...
The typing spec currently says this: > Python’s numeric types complex, float and int are not subtypes of each other, but to support common use cases, the type system contains...
Picking up from https://discuss.python.org/t/would-adding-converter-to-dataclass-transform-even-need-a-pep/55125 Which stems from https://discuss.python.org/t/pep-712-adding-a-converter-parameter-to-dataclasses-field/26126 (already discussed) this PR adds `converter` as another field specifier parameter.
This term is used in a few places in the spec, but never defined. I think it is intended to mean "a type specified by the name of a Python...
See https://github.com/python/typing/pull/1743#discussion_r1641580302
See https://github.com/python/typing/pull/1743#discussion_r1640641003
See https://github.com/python/typing/pull/1743#discussion_r1640637378
My suggestion is to add a way to coerce type narrowing without any runtime change, by adding new `type_assert` and/or `ensure_type`. ```python def function(arg: Any): type_assert isinstance(arg, int) reveal_type(arg) #...