-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Labels
MaintenanceBug fix, typo fix, or general maintenance.Bug fix, typo fix, or general maintenance.topic: IndexingArray indexing.Array indexing.
Description
Currently __getitem__()/__setitem__() accept array 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 before array. 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.:
keycan only be anarrayif it is valid for boolean array indexing, or supports__index__()i.e. is a 0-dimensional integer array.
Metadata
Metadata
Assignees
Labels
MaintenanceBug fix, typo fix, or general maintenance.Bug fix, typo fix, or general maintenance.topic: IndexingArray indexing.Array indexing.