Skip to content

Fix intransitive subtyping issue with SupportsGetItem#8785

Merged
hauntsaninja merged 3 commits intopython:masterfrom
hauntsaninja:fix-supports-get-item-weirdness
Sep 23, 2022
Merged

Fix intransitive subtyping issue with SupportsGetItem#8785
hauntsaninja merged 3 commits intopython:masterfrom
hauntsaninja:fix-supports-get-item-weirdness

Conversation

@hauntsaninja
Copy link
Collaborator

See python/mypy#13713 for details

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

... why is typing.Container even generic in the first place??

@hauntsaninja
Copy link
Collaborator Author

hauntsaninja commented Sep 23, 2022

Maybe it once had a strict annotation for __contains__? Maybe it just felt aesthetically wrong to have a container that wasn't generic. Didn't have time to spelunk. In an ideal world it would be removed, but I assumed it'd be too breaking to touch.

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

I guess it is pretty nice to say something's a Container[str] if it contains strings, even if it is meaningless to the type checker

@AlexWaygood
Copy link
Member

It might be nice to add a comment to typing.pyi noting the oddity, though

@hauntsaninja
Copy link
Collaborator Author

I did a spelunk, and it's always been this way. From before typeshed:
337abed#diff-009a41a8f985ef690b94fb876cfcd4d00fff765eb3f41468a1d816c555bc338bR91
And from the earliest days of mypy:
python/mypy@05f70ca#diff-e114935a16df41cf681c93cd8be4e3b681194568d45c54f4df7985e149395dbcR265

@AlexWaygood
Copy link
Member

I did a spelunk, and it's always been this way. From before typeshed: 337abed#diff-009a41a8f985ef690b94fb876cfcd4d00fff765eb3f41468a1d816c555bc338bR91 And from the earliest days of mypy: python/mypy@05f70ca#diff-e114935a16df41cf681c93cd8be4e3b681194568d45c54f4df7985e149395dbcR265

We did simultaneous spelunking, I arrived at the same conclusion :-)

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants