Why are the type parameters `set`, `frozenset`, `dict` and `frozendict` are generic in unbounded?
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
Excuse me if this question may come across as stupid, but these hashed containers should only have hashable items. However, in builtins.pyi, I see that their type variables do not have an upper bound of collections.abc.Hashable. How is that so?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generic container definitions in builtins.pyi and compare their type parameters with the runtime behavior of set, frozenset, dict, and frozendict. Consult the relevant Python typing and collections.abc.Hashable documentation, then explain why the current unbounded parameters are intentional or identify the stub change needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100