3 ms·
D has integration with Python/Matplotlib too =P http://pyd.readthedocs.org http://pyd.readthedocs.org http://d.readthedocs.org/en/latest/examples.html#plotting-
by 9il 11y ago
D has integration with Python/Matplotlib too =P
http://pyd.readthedocs.org http://pyd.readthedocs.org
http://d.readthedocs.org/en/latest/examples.html#plotting-with-matplotlib-python http://d.readthedocs.org/en/latest/examples.html#plotting-wi...
- jboy 11y agoIt looks like you need to copy your D array to a newly-allocated Numpy ndarray before you can pass it to Python. So there's no binary PyArrayObject interoperability between D & Python (right?). Copying large N-D arrays all the time sounds slow... (That Matplotlib example uses the function `d_to_python_numpy_ndarray` in the PyD project, which I found defined here: https://github.com/ariovistus/pyd/blob/master/infrastructure/pyd/extra.d#L82 https://github.com/ariovistus/pyd/blob/master/infrastructure... . It clearly allocates a new Numpy array: https://github.com/ariovistus/pyd/blob/master/infrastructure/pyd/extra.d#L97 https://github.com/ariovistus/pyd/blob/master/infrastructure... ) Also, I couldn't find any examples of invoking D functions from Python. In fact, I could only find mentions on the D mailing list of people reporting that they couldn't get it to work: http://forum.dlang.org/post/rdhrvzhhwxgfyxzjevfu@forum.dlang.org http://forum.dlang.org/post/rdhrvzhhwxgfyxzjevfu@forum.dlang... By compiling (transpiling) to C, Nim really does have an unfair advantage in the interoperability challenge...
- 9il 11y agondslice was merged to DLang master repo today. It is not a problem to fix PyD. (compiling to C is crispy) EDIT: Exposing-d-functions-to-python http://pyd.readthedocs.org/en/latest/functions.html#exposing-d-functions-to-python http://pyd.readthedocs.org/en/latest/functions.html#exposing...