This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author AlexWaygood
Recipients AlexWaygood, Dennis Sweeney, JelleZijlstra, gvanrossum, kj, rhettinger, serhiy.storchaka, sobolevn
Date 2022-01-16.13:58:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642341539.27.0.817319105121.issue46399@roundup.psfhosted.org>
In-reply-to
Content
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()
```
History
Date User Action Args
2022-01-16 13:58:59AlexWaygoodsetrecipients: + AlexWaygood, gvanrossum, rhettinger, serhiy.storchaka, JelleZijlstra, Dennis Sweeney, sobolevn, kj
2022-01-16 13:58:59AlexWaygoodsetmessageid: <1642341539.27.0.817319105121.issue46399@roundup.psfhosted.org>
2022-01-16 13:58:59AlexWaygoodlinkissue46399 messages
2022-01-16 13:58:59AlexWaygoodcreate