Currently mypy derives Any for value, while ty and pyright derive their unknown types. This makes this extra unsafe, since typos are really just ignored. If they would at least derive object here, this would be mitigated. On the other hand I can image code like this, which would be complicated by this:
from io import Reader
def io_stuff(reader: Reader[str]) -> None:
match reader:
case object(seek=seek):
reader.seek(0)
Ironically, this is accepted by mypy and pyright, but rejected by ty: “Object of type Reader[str] has no attribute seek”.
Edit: Changing it to case Reader(seek=seek) is even more wild:
- Accepted at runtime.
- ty now also complains: “Class
Readercannot be used in a class pattern” - mypy now complains “Class “io.Reader[Any]” has no attribute “seek”” and ““Reader[str]” has no attribute “seek””
- pyright still accepts it