Skip to content

Add type hints / annotations to array_namespace(): array_api_strict as return type? #194

Description

@34j

Without type hints, it is very inconvenient because of spelling errors of array_api functions. As array_api_compat seems to be a superset of array_api_strict, I would like to propose to simply set the return type of array_namespace() to array_api_strict, although it might be confusing.

def array_namespace(*xs, api_version=None, use_compat=None):

from typing import overload
import array_api_strict

array_api_compat_type = array_api_strict

@overload
def array_namespace(*xs, api_version=None, use_compat: None=None) -> array_api_compat_type:
	...

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions