Typing with Variadic Generics in python 3.11 (PEP 646)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
What is your issue?
I just saw this new typing feature in python 3.11, and I'm wondering whether / where we could usefully use this? The feature is parametrizing Generics with arbitrary numbers of TypeVars, which allows you to have Array types whose static typing behaviour is a function of their shape. (But we could possibly use it for a tuple of dims too...) We might use it to do things like:
- Specify that a function expects an array of a certain dimensionality
- Overload methods based on the array dimensionality (e.g.
.plotfor 1D vs 2D arrays) - (If they implement Shape Arithmetic) Type hint how certain methods will change the output shape?
@headtr1ck @max-sixty any thoughts?
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
The issue names PEP 646 and possible uses for xarray array shapes, but no files, tests, or entry points. Start by reading PEP 646 and reviewing the proposed use cases; the work is complete only after the project agrees on a concrete typing scope and implementation target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100