Skip to content

Make Mapping covariant #510

@JukkaL

Description

@JukkaL

I think that Mapping[KT, VT] should be covariant in both KT and VT. The argument for this is that it doesn't have any mutation operations. Mypy might complain (or may eventually start to complain) about having covariant type variables in argument types but in this case it's okay so we can probably just # type: ignore them.

(It wouldn't be safe since somebody can write a get method that actually mutates the mapping, but consenting adults...)

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