Skip to content

ParamSpec P.args not Iterable; P.kwags does not have "Items" #12660

Closed

Description

@rbroderi
P = ParamSpec("P")
R = TypeVar("R")
  def dec_test(func: Callable[P, R]) -> Callable[P, R]:
      @wraps(func)
      def inner(*args: P.args, **kwargs: P.kwargs) -> R:
          for a in args:
              print(a)
          for arg_k, arg_v in kwargs.items():
              print(f"{arg_k},{arg_v}"
          return func(*args, **kwargs)
  
      return inner

Expected Behavior
P.args should be iterable
P.kwargs should have items()

Actual Behavior
"P.args" has no attribute "iter" (not iterable)
"P.kwargs" has no attribute "items"
Your Environment

  • Mypy version used: 0.931
  • Python version used: 3.10.4
  • Operating system and version: Windows 10

Activity

  1. changed the title [-]ParamSpec P.args not Iterable[/-] [+]ParamSpec P.args not Iterable; P.kwags does not have "Items"[/+] on Apr 23, 2022
  2. AlexWaygood commented on Apr 24, 2022

    @AlexWaygood
    Member

    Duplicate of #12386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-paramspecPEP 612, ParamSpec, Concatenate

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions