Re:Import C++ files directly from Python
by versteegen on Friday May 20, 2016 @08:00AM
(#11737069)
Very nice! This seems more convenient than using Cython glue code. But how on Earth had I not heard of pybind11, the magic library that this is built on? It's just what I wanted: boost::python without boost.
[ Parent
| on HN ]
Re:Import C++ files directly from Python
by dr_zoidberg on Friday May 20, 2016 @09:50AM
(#11737732)
When I read it, it remind me of Cython's pyximport:
>>> import pyximport; pyximport.install()
>>> import helloworld
Hello World
The example is taken from Cython's basic tutorial page[0], in which helloworld.pyx simply has a print "Hello World" statement.However I don't don't Cython and cppimport are interchangeable, or that using one excludes using the other. cppimport is for bringing C++ code in a seamless way, while Cython makes it easy to optimize Python code converting it to C (which you can further hand optimize if you so need it).
[0] http://docs.cython.org/src/tutorial/cython_tutorial.html
Re:Import C++ files directly from Python
by barkingdog on Friday May 20, 2016 @09:51AM
(#11737753)
I have the same reaction as you. I am very impressed by this, as well as pybind11. My only worry is the fear that the automagic will break down somewhere, but I hope I am wrong and it will not hurt to try! If it works, it will significantly speed up my integration with an SDK that would have required enough extra hours to have otherwise not been worth it. Very exciting.