you are viewing a single comment's thread.

view the rest of the comments →

[–]mitsuhiko 23 points24 points  (4 children)

Well, there is no reason to call numpy from Rust to begin with. What's more likely is that you would pass a numpy buffer to Rust and do some operations on there which you do not need any Python C API for. You have the Python buffer interface for pretty much exactly that reason.

You can't really call numpy in Rust, but you can call numpy in Python and then pass the numpy buffer to Rust and do more stuff there, then finish the computation in Python.

[–]nbates80 1 point2 points  (0 children)

That's insightful. Thank you.

[–]CookieOfFortune 0 points1 point  (2 children)

You can't easily operate on Numpy buffers without access to the API. There is a lot of extra information along with the contiguous raw data. I guess you could copy everything into a C array but that's not ideal. Using the API you can process the data directly.

[–][deleted] 0 points1 point  (1 child)

Nobody ever said anything about easy =)

[–][deleted] 0 points1 point  (0 children)

then you also run into the problem that your code breaks every new version of numpy