python / python/typing

ParamSpec: bound, covariant, contravariant

Open
#1,027 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: other
Dominant language
Python
Stars
1.8k
Forks
302
Avg merge
23h
Merged PRs (30d)
8

Description

I found that right now ParamSpec allows three kw-only arguments: bound=None, covariant=False, contravariant=False. Just like PEP612 states:

The runtime should accept bounds and covariant and contravariant arguments in the declaration just as typing.TypeVar does, but for now we will defer the standardization of the semantics of those options to a later PEP.

What are the use-cases for this? How can ParamSpec can be bound to a value? Or how can it be covariant? It does not seem to be semantically valid.

Maybe we should remove these arguments? What do others think?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading PEP 612 and the existing ParamSpec declaration, then review the eight-comment discussion for an agreed direction. Done requires a settled answer on whether bound, covariant, and contravariant arguments have valid semantics or should be removed, followed by the corresponding project change.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.