python / python/peps

PEP 677: Callable Type Syntax

Open
#3,920 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
reStructuredText
Stars
5k
Forks
1.8k
Avg merge
2d 4h
Merged PRs (30d)
25

Description

Documentation

(A clear and concise description of the issue.)
In one of your examples there seems to me to be a small oversight:
from typing import Any, Callable, Concatenate, ParamSpec, TypeVar

R = TypeVar("R")
P = ParamSpec("P")

def with_retries(
    f: Callable[P, R]
) -> Callable[Concatenate[bool, P] R]:
    def wrapper(retry_once: bool, *args: P.args, **kwargs: P.kwargs) -> R:
        ...
    return wrapper

...
where -> Callable[Concatenate[bool, P] R]:
do: -> Callable[Concatenate[bool, P], R]:

Thanks very much

Contributor guide

Open the contributing guide

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

Open the PEP 677 documentation and find the with_retries example containing Callable[Concatenate[bool, P] R]. Compare the reported annotation with the surrounding example and correct the documented typo. Done means the example uses the valid form and the PEP renders consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.