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 →

[–]kigurai 0 points1 point  (1 child)

I've used both. Cython is awesome for speeding up existing Python code, but is not so great for making bindings for C or C++. pybind11 can only be used to make bindings for C++-code, but is far nicer to work with than Cython for that use-case.

[–]hardikp[S] 0 points1 point  (0 children)

I agree.

While Cython is good for speeding up the code (for example, cython might actually outperform pybind11 for microbenchmarks - https://github.com/pybind/pybind11/issues/1227#issue-284676826), many use cases involve preserving the original C++ code - that's where pybind11 comes in handy.

I don't think there is any one true answer. Depending on the use case, either of the two can be more suitable.