Skip to content
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

Update InlineTypedDict Implementation to conform to PEP 764 Specification #18748

Open
DanieleIsoni opened this issue Mar 2, 2025 · 1 comment

Comments

@DanieleIsoni
Copy link

Feature

Align the experimental InlineTypedDict feature with the PEP 764 specification.

Pitch

The current experimental InlineTypedDict syntax in mypy allows for concise inline TypedDict definitions, but it does not fully conform to the PEP 764. Updating this feature to adhere to PEP 764 would ensure consistency with the official Python typing standards and enhance compatibility across type checkers and codebases.

Example of the PEP 764 syntax:


def func(n: str, y: int) -> TypedDict[{"name": str, "year": int}]:
    return {"name": n, "year": y}
@JelleZijlstra
Copy link
Member

From offline discussion with @ilevkivskyi, we're OK adding support for the PEP 764 syntax but we'd like to keep the existing syntax as a mypy-specific extension.

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

No branches or pull requests

3 participants