MilanStaffehl / numdantic

Typing support for numpy arrays and numpy array validation with pydantic.
MIT License
1 stars 0 forks source link

Improve the type vars for shape #27

Closed MilanStaffehl closed 1 month ago

MilanStaffehl commented 1 month ago

There is now still a type: ignore instruction in the definition of the shape part of the NDArray type, that seems ill-advised:

_ShapeTypeVar = TypeVar("_ShapeTypeVar", bound=Shape)  # type: ignore

See if it can be removed by properly accounting for the missing type parameters of Shape or by typing the NDArray diferently. This could potentially also lead to a solution of the problem with the invariance of the TypeVarTuple used in the shape: the _ShapeTypeVar could be made covariant - check if that changes anything.

MilanStaffehl commented 1 month ago

This will be closed when #9 is implemented as it will then be bound to tuple[int, ...].