8000 PEP 612 support · Issue #794 · python/typing · GitHub
[go: up one dir, main page]

Skip to content

PEP 612 support #794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
markedwards opened this issue Apr 4, 2021 · 9 comments
Closed

PEP 612 support #794

markedwards opened this issue Apr 4, 2021 · 9 comments

Comments

@markedwards
Copy link

Is there a schedule for adding support for PEP 612 (ParamSpec) to typing_extensions?

@JelleZijlstra
Copy link
Member

There is an open pull request: #774.

@markedwards
Copy link
Author

Thanks for the pointer @JelleZijlstra

@gvanrossum
Copy link
< 8000 div class="d-none d-sm-flex"> Member
gvanrossum commented Apr 5, 2021 via email

@JelleZijlstra
Copy link
Member

I will, I can ping you once I'm happy with it.

@JelleZijlstra
Copy link
Member

This has now been merged.

@markedwards
Copy link
Author

Thanks!

@markedwards
Copy link
Author
markedwards commented Oct 23, 2021

Following up on this, running mypy 0.910 and typing-extensions 3.10.0.2, I get errors with the documentation example for ParamSpec:

import logging
from collections.abc import Callable
from typing import TypeVar

from typing_extensions import ParamSpec

T = TypeVar('T')
P = ParamSpec('P')


def add_logging(f: Callable[P, T]) -> Callable[P, T]:
# mypy complains for the above line:
#     The first argument to Callable must be a list of types or "..."

    def inner(*args: P.args, **kwargs: P.kwargs) -> T:
    # mypy complains for the above line:
    #     Name "P.args" is not defined
    #     Name "P.kwargs" is not defined
        logging.info(f'{f.__name__} was called')
        return f(*args, **kwargs)
    return inner

Is it not possible to use ParamSpec in python 3.9?

@srittau
Copy link
Collaborator
srittau commented Oct 23, 2021

mypy 0.910 doesn't support ParamSpec yet.

@markedwards
Copy link
Author

@srittau Thanks, I see python/mypy#8645 now

4D87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0