typing
typing copied to clipboard
Python static typing home. Hosts the documentation and a user help forum.
According to https://typing.readthedocs.io/en/latest/guides/libraries.html#library-interface-public-and-private-symbols: > A module can expose an `__all__` symbol at the module level that provides a list of names that are considered part of the interface. This overrides...
I'm not sure how all this works, so if my idea doesn't make sense or isn't feasible, no worries. My thought is to have a generic type that could encompass...
It's my understanding that overloads are processed in order. I.e. given the following overloads: ```python @overload def foo(x: int) -> None: ... @overload def foo(x: int | str) -> None:...
Currently the [section on variance](https://typing.readthedocs.io/en/latest/spec/generics.html#variance) says: > A longer introduction to these concepts can be found on [Wikipedia](https://en.wikipedia.org/wiki/Covariance_and_contravariance_%28computer_science%29) and in [PEP 483](https://peps.python.org/pep-0483/); here we just show how to control a...
https://discuss.python.org/t/permit-inferring-self-for-unannotated-self/65190 https://typing--1860.org.readthedocs.build/en/1860/spec/annotations.html
It looks like there should be `Any` instead of `int`, because the documentation says the following: """ We can also pass a `*tuple[int, ...]` wherever a `*Ts` is expected. This...
The spec currently [defines](https://typing.python.org/en/latest/spec/concepts.html#materialization) materialization as follows: > Given a gradual type A, if we replace zero or more occurrences of Any in A with some type (which can be...
The [typing spec states](https://typing.python.org/en/latest/spec/callables.html#overloads) that, when `A` and `B` are potentially overloaded methods > If a callable `B` is overloaded with two or more signatures, it is [assignable](https://typing.python.org/en/latest/spec/glossary.html#term-assignable) to callable...
I sometimes get asked why a `lambda` function can't be type-checked. And I believe the answer is that the arguments and result of a `lambda` can't be inferred by a...
Will post about this on Discourse in a moment.