Skip to content

Default Values for TypedDict #17

@rmorshea

Description

@rmorshea

It would be nice if you could set default values for a TypedDict:

class Coordinate(TypedDict):
    x: int = 0
    y: int = 0
    z: int = 0

# current behavior
assert Coordinate() == {}
# desired behavior
assert Coordinate() == {"x": 0, "y": 0, "z": 0}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions