Skip to content

PEP-612 Concatenate not recognized properly #11833

Closed
@wrobell

Description

@wrobell

Please consider example from PEP-612

from typing import Concatenate, Callable, TypeVar, ParamSpec

R = TypeVar('R')
P = ParamSpec('P')

class Request:
    pass

def with_request(f: Callable[Concatenate[Request, P], R]) -> Callable[P, R]:
  def inner(*args: P.args, **kwargs: P.kwargs) -> R:
    return f(Request(), *args, **kwargs)
  return inner

then

$ mypy t6.py
t6.py:9: error: The first argument to Callable must be a list of types or "..."
Found 1 error in 1 file (checked 1 source file)

I would expect Concatenate to be accepted as the first argument of Callable.

Mypy 0.930, Python 3.10.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions