Skip to content

Conversation

@Avasam
Copy link
Collaborator

@Avasam Avasam commented Sep 26, 2025

Checked against the implementation to see when SupportsGetItem wasn't enough.

Will also reduce changes from #14038

CC @darabos since you added most of these in #13458 . Feel free to re-validate against the implementation.

@github-actions

This comment has been minimized.

Copy link
Contributor

@darabos darabos left a comment

Choose a reason for hiding this comment

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

Looks great to me! Thank you!

@github-actions

This comment has been minimized.

@Avasam Avasam requested a review from srittau November 3, 2025 04:33
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

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

@srittau
Copy link
Collaborator

srittau commented Nov 14, 2025

I'm not a fan of replacing protocols with ABCs, especially if they're as broad as Mapping. Can't we use broader protocols?

@Avasam
Copy link
Collaborator Author

Avasam commented Dec 18, 2025

I can re-review usage. Mixing mapping-based protocols is quite annoying at the moment (without Protocol Intersection), and we may be getting too close to implementation details, where I'm not sure it's worth creating new (and/or combined) protocols just for this. But I'll see.

@srittau
Copy link
Collaborator

srittau commented Dec 18, 2025

My main beef with Mapping (and Sequence) is that it's not a protocol. Maybe it would make sense to add a MappingLike protocol to _typeshed that includes commonly used methods (like __getitem__, keys etc.).

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Let's go with Mapping for now. We can always replace them later if #15146 gets merged and has made its way into type checkers.

@srittau srittau merged commit 3c2dbb1 into python:main Dec 19, 2025
48 checks passed
@Avasam Avasam deleted the networkx-incorrect-SupportsGetItem branch December 20, 2025 00:00
@Avasam
Copy link
Collaborator Author

Avasam commented Dec 20, 2025

Thanks. And I think you meant #15152

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.

3 participants