Skip to content

Type of return value from indexing #123

Closed
@shoyer

Description

@shoyer

The current spec is silent on what the return value from an indexing operation should be: https://data-apis.github.io/array-api/latest/API_specification/indexing.html

I propose that the return value should always be another array object, i.e., so __getitem__ could be type annotated as __getitem__(self: Array, key: IndexKey) -> Array. However, this is inconsistent with NumPy, which returns NumPy scalars in some cases when indexing with integers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions