lcompilers / lpython

Python compiler
https://lpython.org/
Other
1.5k stars 157 forks source link

Suggestion: replace Array type with numpy.typing.NDArray #2483

Open rebcabin opened 7 months ago

rebcabin commented 7 months ago

So far as I can tell, the semantics are identical. I believe we ought to use a popular, existing type rather than inventing our own type, if we can.

https://numpy.org/devdocs/reference/typing.html

certik commented 7 months ago

The numpy.typing.NDArray semantics is different. Doesn't seem to allow specifying rank and dimensions at compile time, which is needed for ASR arrays.

If you know how to use it in our tests and preserve the information that we need, then we should definitely do it.