typing icon indicating copy to clipboard operation
typing copied to clipboard

Python static typing home. Hosts the documentation and a user help forum.

Results 241 typing issues
Sort by recently updated
recently updated
newest added

I noticed that the conformance test currently enforces a hashability check on dataclasses: https://github.com/python/typing/blame/6d5c186ea3f45dd80dcad9f172479b270e54966a/conformance/tests/dataclasses_hash.py If we take the [annotation of `typing.Hashable`](https://github.com/python/typeshed/blob/main/stdlib/typing.pyi#L425-L431) and the [annotation of `object`](https://github.com/python/typeshed/blob/main/stdlib/builtins.pyi#L114) literally, then no type...

topic: conformance tests

I attempted to run the conformance tests locally using Python 3.12, following the instructions given in https://github.com/python/typing/blob/main/conformance/README.md#running-the-conformance-test-tool. The mypy, pyright and pyre tests all ran, but the pytype tests crashed...

topic: conformance tests

* Attempts to clearly define the algorithm for overload matching. * Describes checks for overload consistency, overlapping overloads, and implementation consistency.

`Counter` overloads are unsafe ```python from collections import Counter # no type errors reported and nothing tricky going on a = {"a": "hello"} b = Counter(a) c = b.get("a", 0)...

topic: other

I think this much can be inferred, since the specs already said that: * `type[A | B]` is supported, and * `B` the class is a valid value for `type[A...

In this code: ```py from typing import TypeVar, Generic T = TypeVar('T') class Foo(Generic[T]): @staticmethod def create(arg: T) -> 'Foo[T]': ... reveal_type(Foo.create(1234)) ``` What should the type be? Should `T`...

topic: feature

One thing that I've found underspecified when using `@overload` is what the type signature of the actual function should be. For example, let's say I have a function like: ```python...

topic: documentation

## `Unknown` Definition A type that can only be cast to `Any` ## Problem Currently when type checkers fail to understand the type of a function/variable, they fallback on `Any`....

topic: feature

At runtime, the following members are currently excluded by `Protocol`: ([source](https://github.com/python/cpython/blob/4c317918486348ff8486168e1003be8c1daa6cf5/Lib/typing.py#L1863-L1878)) ```python _TYPING_INTERNALS = frozenset({ '__parameters__', '__orig_bases__', '__orig_class__', '_is_protocol', '_is_runtime_protocol', '__protocol_attrs__', '__non_callable_proto_members__', '__type_params__', }) _SPECIAL_NAMES = frozenset({ '__abstractmethods__', '__annotations__', '__dict__',...

topic: documentation

This is a followup from discussion on discourse, and specifically [this example](https://discuss.python.org/t/problems-with-typeis/55410/46) which was constructed with the help of many going back and forth to determine a situation that could...

topic: documentation