KotlinIsland / KotlinIsland/basedmypy

`Container.__contains__` should be generic

Open
#866 0 comments 0 reactions 0 assignees View on GitHub
feature good first issue typeshed
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Research direction

The issue provides no file or test path; start by locating the Python typing definition of the Container protocol and reviewing its generic behavior. Done means __contains__ uses the type parameter with safe variance, with regression coverage for the updated signature.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.