Skip to content

Annotations for set.__sub__ and related methods are inconsistent #9004

@LeeeeT

Description

@LeeeeT

According to the documentation s1 - s2 returns the set of all elements that are in s1 but not in s2. So what's the point of constraining s2 elements type? I believe the correct annotation for the argument of set.__sub__ would be AbstractSet[object] rather than AbstractSet[T | None].

def __sub__(self, __s: AbstractSet[_T | None]) -> set[_T]: ...

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