More strict type checking

Open
#6 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python

Research direction

Start by reviewing the array API functions and their existing type signatures to determine how inputs are currently validated. Compare possible explicit-checking approaches and define what consistent, actionable errors should look like before deciding whether the work can be automated.

Written by the indexing model from the issue text.

Description

Medium Priority

In numpy.array_api, we said that type checking that inputs were Array was too much overhead, and we would just rely on the the type signatures and type checking to do this.

However, given that we are no longer thinking of this library as something that is used in production, I don't think we need to worry so much about the overhead of type checking. It might be a good idea to add explicit type checks to functions. This would prevent a sufficiently duck-typed object from silently passing through, although that's pretty unlikely since basically every function uses x._array on its input. The real reason would be to provide better error messages that AttributeError on bad inputs.

Maybe this can be done automatically from the type signatures using one of those fancy libraries I know nothing about.

Dominant language
Python
Stars
34
Forks
14
Avg merge
3m
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from data-apis/array-api-strict

All issues in data-apis/array-api-strict

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.