Skip to content

Container.__contains__ should be generic #866

@KotlinIsland

Description

@KotlinIsland
@runtime_checkable
class Container(Protocol[_T_co]):
    # This is generic more on vibes than anything else
    @abstractmethod
    def __contains__(self, x: object, /) -> bool: ...
@runtime_checkable
class Container(Protocol[_T_co]):
    @abstractmethod
    # must implement safe variance
    def __contains__(self, x: _T_co, /) -> bool: ...  # type: ignore[unsafe-variance]

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions