A way to relax param-spec -- AnyLike
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 302
- Avg merge
- 23h
- Merged PRs (30d)
- 8
Description
What what i would really like is https://github.com/python/typing/issues/1506
however mapping types is pretty complex and general.
Consider something like Dask's client.submit
submit[T, **P](self, func: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> Future[T]
What it actually wants is any type in the outer arguments can be
either the original type Q, in P.args or P.kwargs, or Future[Q].
But specifying that is a bit fiddly.
A less complex thing would be to introduce a special form AnyLike
which can be run as
submit[T, **P](self, func: Callable[P, T], *args: AnyLike[P].args, **kwargs: AnyLike[P].kwargs) -> Future[T]
which would have the effect of allowing the types in
args to be Any but the number must match that in the paramspec P,
and similar the types in kwargs can be Any but the names must till match those in the paramspec P
Contributor guide
No contributing guide indexed for this repository
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 reading typing issue 1506 and the proposed AnyLike usage for Dask's client.submit. Define the intended semantics for P.args and P.kwargs, including argument counts and keyword names, and consider how the proposal fits existing ParamSpec behavior; done means an agreed specification for the new special form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100