Why `_types.finfo_object` and `_types.iinfo_object`, `_array_object._array` does not inherit `Protocol` ?

Open
#856 0 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
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Read src/array_api_stubs/_draft/_types.py at lines 60–79 and src/array_api_stubs/_draft/array_object.py at lines 19–20, then compare the declarations with the issue’s Protocol and dataclass question. The issue does not specify a concrete change or acceptance criterion, so completion requires an explicit maintainer decision about the intended type design.

Written by the indexing model from the issue text.

Description

topic: Static Typing

https://github.com/data-apis/array-api/blob/6d205d72dde3db8fc8668ad6aef5d003cc8ef80f/src/array_api_stubs/_draft/_types.py#L60-L79

 class finfo_object(Protocol[dtype]): 
     """Dataclass returned by `finfo`.""" 
  
     bits: int 
     eps: float 
     max: float 
     min: float 
     smallest_normal: float 
     dtype: dtype 
  
  
 class iinfo_object(Protocol[dtype]): 
     """Dataclass returned by `iinfo`.""" 
  
     bits: int 
     max: int 
     min: int 
     dtype: dtype 

I wonder why they are defined as dataclass

https://github.com/data-apis/array-api/blob/6d205d72dde3db8fc8668ad6aef5d003cc8ef80f/src/array_api_stubs/_draft/array_object.py#L19-L20

array = TypeVar("array", bound="_array")

class _array(Protocol[Device, Dtype, PyCapsule, array])
	def __add__(self, other: Union[int, float, array], /) -> array:
Dominant language
Python
Stars
281
Forks
52
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

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

All issues in data-apis/array-api

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.