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

Neal Becker ndbecker2 at gmail.com
Fri Aug 17 17:59:31 EDT 2018


The only way I've seen xtensor used is with pybind11

On Fri, Aug 17, 2018 at 5:45 PM Robert Kern <robert.kern at gmail.com> wrote:

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


NumPy-Discussion mailing list NumPy-Discussion at python.org https://mail.python.org/mailman/listinfo/numpy-discussion -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180817/ae7b610d/attachment.html>



More information about the NumPy-Discussion mailing list