Skip to content

functools.partial should use PEP612 ParamSpec (depends on #8708) #8703

Open
@benbariteau

Description

@benbariteau

Currently, functools.partial's __call__ method takes *args: Any, **kwargs: Any and returns _T (a TypeVar for the return type of the callable the partial is wrapping). This is decent, but matching the parameter typing would make this more useful in more situations.

I can sort of see how to deal with this, although I'll admit I'm unsure how to make this generically work. I imagine you could probably deal with some number of Concatenates (maybe up to 5 or 10) to deal with most cases. It's possible fixing this requires another PEP to allow an arbitrary-length Concatenate-type pattern.

Related to python/mypy#1484

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: deferredIssue or PR deferred until some precondition is fixed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions