-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify that dunder get/set item accepts SupportsIndex
#383
Comments
Just to be clear, the point of
I would omit this part. Any type can implement |
@honno Would you be willing to open a PR addressing this issue for the v2024 revision? |
Currently
__getitem__()
/__setitem__()
acceptarray
as keys, which implicitly has to be boolean arrays, or 0d integer arrays i.e. has a working__index__()
. The latter is not an obvious concept to grasp, and maybe not even quite specified anyway.I propose we add the stdlib
typing.SupportsIndex
to the get/set item signatures, specifically beforearray
. This does add support for any indexable type, but that seems okay, and was the intention anyway when__index__()
was proposed in #231. I also think a note would be helpful in regards to what arrays are accepted, e.g.:cc @kgryte @asmeurer
The text was updated successfully, but these errors were encountered: