typing
typing copied to clipboard
Python static typing home. Hosts the documentation and a user help forum.
My understanding is that symbols defined at the module scope of a stub file and begin with an underscore are meant to be private to the stub — that they...
I cannot quite pinpoint the interaction of the defaults in `typing.dataclass_transform()` and `__init_subclass__`/`__new__` parameters. [PEP-681](https://peps.python.org/pep-0681) does not seem to cover that at all, so perhaps I am missing something very...
CPython and most typing-related repositories have switched to `main` from `master`. I suggest we do the same in this repository for consistency's sake.
Pitch --- Add [`typing.PartialApplication`](https://en.wikipedia.org/wiki/Partial_application) to facilitate the implementation of: - `__get__`, and - `functools.partial`, both of which are practically impossible to natively (without plugins) annotate. The `__get__` method is currently...
Given some base class that is generic over a param-spec, I'd like to be able to *define* the param-spec using a subclass method implementation. Something like: ```python T = TypeVar("T")...
`TypedDict` instances work very well for NoSQL databases, like Mongo DB, but for any extended functionality a class is required, and marrying the two requires a few error-prone steps described...
I'd like to make both instances and the types of functions and methods (including builtin methods) subscriptable. Part of this proposal has been discussed already on python-ideas (https://discuss.python.org/t/making-functions-subscriptable-at-runtime/26463) but I...
PEP 698 (`typing.override`) suggests that type-checkers provide a strict enforcement option that would mark method overrides. However, no guidance is provided about the methods `__init__` and `__new__`. These methods are...
I would like to move our [nocaselist](https://pypi.org/project/nocaselist/) package forward to use type hints. So far, its class `NocaseList` is based on class `list`. I would like to keep that. However,...
```py from typing import TypedDict, Unpack class A[ExtraArgs: TypedDict]: def do_it(self, **extra: Unpack[ExtraArgs]): ... class Thing(TypedDict): t: int A[Thing]().do_it( t=1, # no error imposter="sus", # yes error ) ```