Skip to content

Make Mapping covariant in key #1114

Closed as not planned
Closed as not planned
@JukkaL

Description

@JukkaL

Mapping should be covariant. See discussion at #1113.

Note that the key type is used as an argument type to __getitem__ and get, so mypy may complain about a covariant key type variable, but we can just ignore that error in the stub, as covariance is safe in this case. Mapping doesn't support mutation operations and __getitem__ can fail even in fully type safe code.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions