typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

Annotations for `set.__sub__` and related methods are inconsistent

Open LeeeeT opened this issue 2 years ago • 17 comments

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].

https://github.com/python/typeshed/blob/cf9bdc2d9861cb61e76b512988d19afe232a958f/stdlib/builtins.pyi#L1100

LeeeeT avatar Oct 27 '22 16:10 LeeeeT