Skip to content

Inconsistency over Container #397

Closed
Closed
@abarnert

Description

@abarnert

In collections.abc, Sequence, Mapping, and Set all inherit from Container.

In typing, Sequence[T] inherits from Container[T], while Mapping[T] and AbstractSet[T] do not, and instead define __contains__, which means Container picks them up as a Protocol. Unless there's a reason these have to work differently, it seems like they should all inherit.

Also, Container doesn't annotate its __contains__ method at all, and Mapping and AbstractSet annotate it as taking an object. Shouldn't these all be requiring T?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions