[Numpy-discussion] Add pybind11 to docs about writing binding code (original) (raw)

Robert Kern robert.kern at gmail.com
Fri Aug 17 17:44:01 EDT 2018


On Fri, Aug 17, 2018 at 2:00 AM Hans Dembinski <hans.dembinski at gmail.com> wrote:

Hi Sylvain,

On 16. Aug 2018, at 13:29, Sylvain Corlay <sylvain.corlay at gmail.com> wrote: Actually, xtensor-python does a lot more in terms of numpy bindings, as it uses the C APIs of numpy directly for a number of things. Plus, the integration into the xtensor expression system lets you do things such as view / broadcasting / newaxis / ufuncs directly from the C++ side (and all that is in the cheat sheets). ok, good, but my point was different. The page in question is about Python as a glue language. The other solutions on that site are general purpose binding solutions for any kind of C++ code, while xtensor-python is xtensor-specific. xtensor in turn is a library that mimics the numpy API in C++.

Even if you don't use the numpy-mimicking parts of the xtensor API, xtensor-python is a probably a net improvement over pybind11 for communicating arrays back and forth across the C++/Python boundary. Even if the rest of your C++ code doesn't use xtensor, you could profitably use xtensor-python at the interface. Also, though the article is generally framed as using Python as a glue language (i.e. communicating with existing C/C++/Fortran code), it is also relevant for the use case where you are writing the C/C++/Fortran code from scratch (perhaps just accelerating small kernels or whatever). Talking about the available options for that use case is perfectly on-topic for that article.

You don't have to be the one that writes it, though, if you just want to cover pybind11.

-- Robert Kern -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180817/ec7a9b08/attachment.html>



More information about the NumPy-Discussion mailing list