Skip to content

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

Description

@34j

@dataclass
class finfo_object:
"""Dataclass returned by `finfo`."""
bits: int
eps: float
max: float
min: float
smallest_normal: float
dtype: dtype
@dataclass
class iinfo_object:
"""Dataclass returned by `iinfo`."""
bits: int
max: int
min: int
dtype: dtype

↓

 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

class _array:
def __init__(self: array) -> None:

↓

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

class _array(Protocol[Device, Dtype, PyCapsule, array])
	def __add__(self, other: Union[int, float, array], /) -> array:

Activity

  1. changed the title [-]Why `_types.finfo_object` and `_types.iinfo_object` does not inherit `Protocol[dtype]` ?[/-] [+]Why `_types.finfo_object` and `_types.iinfo_object`, `_array_object._array` does not inherit `Protocol` ?[/+] on Nov 24, 2024
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