MilanStaffehl / numdantic

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

Write an example for a wrapper-function around a `numpy` function #14

Open MilanStaffehl opened 2 months ago

MilanStaffehl commented 2 months ago

The README talks about writing custom wrappers or stubs around/for numpy functions, making assignments type-checkable. Write an example for how one might do this, using the simplest option: creating an array with np.array. This example should use type variables and type var tuples to annotate the shape and dtype, so that type checkers then understand how input translates to the created array.

For an example using shape, np.random.randint is probably much better suited, though.