Monadical-SAS / monadical.com

🖥️ Custom Flask + Jinja2 static site generator and content powering Monadical.com
https://monadical.com
10 stars 4 forks source link

posts/virtual-classes-in-cython #68

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Monadical Consulting | Implementing C++ Virtual Functions in Cython

This is an extensive article that assumes Cython knowledge and describes two strategies for using C++ code from Python, requiring the implementation of virtual functions in C++ abstract classes.

https://monadical.com/posts/virtual-classes-in-cython.html

jdcaballerov commented 3 years ago

Python libzim is available here https://github.com/openzim/python-libzim

haxsaw commented 3 years ago

Thanks for the detailed write-up. I'm in the midst of looking at some wrapping technologies for Python over C++, and am currently leaning toward Cython. I share your assessments regarding doc, community, and users, but am still drawn to pybind11 with the notion that it might actually be less work to create bindings using that tool than Cython. There is also concern that Cython will entail more effort in terms of maintenance than pybind11. I was wondering if you could share any thoughts regarding those perspectives from your evaluation of those two tools.

jdcaballerov commented 3 years ago

@haxsaw Thanks for reading. pybind11 is also a good option. In our concrete use case we had to use the existing library C++ code, so to get a pythonic API we needed to wrap it. With Cython we could accomplish that, not as an extra step, while allowing the binding description in pxd files on a python like language. Unlike pybind11's description language that is closer to C++.