Skip to content

Update InlineTypedDict Implementation to conform to PEP 764 Specification #18748

Open
@DanieleIsoni

Description

@DanieleIsoni

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}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions