Alex Waygood <[email protected]> added the comment:
As a fix, I propose that two changes be made to `dict_keys`, `dict_values` and
`dict_items`:
* They should be officially exposed in the `types` module.
* `__class_getitem__` should be added to the classes.
These two changes would mean that users would be able to do the following:
```
from types import dict_keys
from typing import TypeVar
K = TypeVar("K")
V = TypeVar("V")
class DictSubclass(dict[K, V]):
def keys(self) -> dict_keys[K, V]:
return super().keys()
```
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46399>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com