typing
typing copied to clipboard
Python static typing home. Hosts the documentation and a user help forum.
If a function expects an iterable of strings, is it possible to forbid passing in a string, since strings are iterable? Seems like there are many cases where this would...
Currently [PEP 647](https://www.python.org/dev/peps/pep-0647/) doesnt narrow the type in the negative case, i feel like this should be changed to narrow in the negative case, currently due to it not narrowing...
Should there exist a `Numeric` type, as suggested by the [data model](https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types)? That is, one that affirms the existence of the methods described in that section.
There is a frequent pattern of TypeGuard-like functions which `assert` or otherwise raise an exception if a type constraint is not met. For example, https://github.com/microsoft/pyright/issues/2007 points to a case in...
Pythons implementation of typing at the language level has been very limited, with only the absolute minimal changes to the grammar being implemented: - type annotations: `a: int` - return...
```py from typing import _KT, _promote ``` **Success: no issues found in 1 source file** Sure it has an underscore, but seems super sus that there is no mechanism to...
**Feature** A similar feature in [typescript](https://www.typescriptlang.org/docs/handbook/2/typeof-types.html) ```ts const foo: number = 1 type Foo = typeof foo // type Foo = number function bar(x: string): void { } type Bar...
I've been putting some work into typeshed pull requests and I've noticed some places where I could really have used a Proxy Generic class - meaning I can inherit from...
Here is how I envision the typing documentation to be structured: ## Tutorials User-facing basic and advanced introductions to the type system or particular aspects of it. Non-comprehensive. * [...
Importing types can lead to circular imports, longer start up times and unwanted side effects. I want something like: ```py from foo.bar import type Baz def foo(baz: Baz): print(baz.bat) ```...