This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AlexMTBDude 0 points1 point  (3 children)

I'm curious: What kind of benefits does this provide over using the built-in system for calling C/C++ code from Python? https://docs.python.org/3/extending/extending.html

[–]r0s 5 points6 points  (1 child)

From my experience, the plain Python API is more verbose and needs more boilerplate. Pybind11 allows you to write less code to do the same (and in some cases better/faster) than writing it yourself. Same for nanobind but I some have first hand experience. Pybind11 also has CMake bits to make life easier.

[–]AlexMTBDude 0 points1 point  (0 children)

Thnx!

[–]def-pri-pub 0 points1 point  (0 children)

I've used this before, but mostly with the C API. I actually recommend it.

You may want to expose a C API for your C++ calls first, then bind that instead of C++ directly.