Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Representation of ParamSpecs at runtime compared to Callable #102615

Closed
Labels
stdlibStandard Library Python modules in the Lib/ directorytopic-typing
@Gobot1234

Description

@Gobot1234
          I think a list representation is more consistent with the text of PEP 612 and the runtime representation of Callable. We should change the runtime repr of ParamSpec generics to be more like Callable, because right now they're inconsistent:
>>> Callable[[int, str], bool]typing.Callable[[int, str], bool]>>> P = ParamSpec("P")>>> T = TypeVar("T")>>> class MyCallable(Generic[P, T]): pass... >>> MyCallable[[int, str], bool]__main__.MyCallable[(<class 'int'>, <class 'str'>), bool]>>> get_args(Callable[[int, str], bool])([<class 'int'>, <class 'str'>], <class 'bool'>)>>> get_args(MyCallable[[int, str], bool])((<class 'int'>, <class 'str'>), <class 'bool'>)

Originally posted by@JelleZijlstra inpython/typing#1274 (comment)

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-typing

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp