typing
typing copied to clipboard
Python static typing home. Hosts the documentation and a user help forum.
This proposal is aimed at solving two related problem. First, when defining a multi-ary operator on Numpy arrays, e.g., [leaky integral](https://github.com/NeilGirdhar/tjax/blob/0c1b13629a197f38b73f431926cf536d8c682315/tjax/_src/leaky_integral.py), then you ideally want to bake in Numpy type...
Runtime says yes, mypy says yes, pyright says no. It would be nice if pyright and mypy were consistent on this point. The mypy approach makes sense because it matches...
I'm interested in guidance from the typing community relating to a question that came up in a recent [pyright bug report](https://github.com/microsoft/pyright/issues/4685). The issue has to do with the `self` parameter...
I was surprised (discovered in https://github.com/python/typeshed/issues/9723), that typecheckers currently do not consider `type` in annotation context purely generic alias: unlike `list` or `dict`, it is allowed to remain unsubscripted. This...
### Problem Sometimes, attributes and variables are only defined for a specific implementation. E.g. I recently saw that `PyPy` has a `sys.pypy_version_info` variable. At the moment, type checkers only support...
One issue I have run into as a library dev is varying support for typing features or bugs for both of the type checkers. `typing.TYPE_CHECKER` would allow me to change...
I'm making an alternative python AST. Just like the `ast` module, I want attributes to be set on a node using keyword arguments. The only problem with using ```py class...
I just found myself wanting to do the following: ```python from typing import TypedDict, NotRequired, Generic, TypeVar, Union, Never _T = TypeVar('_T') Foo = Union['FooSub1[_T]', 'FooSub2[_T]', 'FooSub3[_T]'] class BaseFoo(TypedDict, Generic[_T]):...
Hi I would like to type a decorator which takes as input a class and returns the same class with added attributes, i.e., a subclass. Example: ```py import typing _T...
I've recently added type annotations to a large library, and have been checking my code using both mypy and pyright. While doing so, I noticed many differences between mypy and...