Implement an analog of map_instance_to_supertype() for protocol supertypes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
In certain situation (like e.g. when dealing with *args) we want to know what are the type arguments of a generic protocol that a given type implements. Currently this is done in ad-hoc way in few places, but it would be great to have a dedicated helper.
This will also help with some advanced issues like https://github.com/python/mypy/issues/3829
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 by locating map_instance_to_supertype() and the existing ad-hoc handling for generic protocols, especially the path involving *args. Read the related discussion in issue #3829 and trace how protocol type arguments are currently inferred. Done means a dedicated helper provides the equivalent mapping for protocol supertypes and the relevant ad-hoc cases can use it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100