/Cpp_Python_bindings

C++ Python bindings using two recursive algorithms, fibonnaci and factorial, as example.

Primary LanguagePython

C++ Python bindings

We implement two recursive algorithms, fibonnaci and factorial, in C++ and make Python bindings using pybind11, without even using CMake. We show here how we can use more than one C++ functions when we make Python bindings. The C++ functions are much faster than the Python implementations. We borrow some ideas from here.

We implement two recursive algorithms, fibonnaci and factorial, in C++ and make Python bindings using pybind11, without even using CMake. We show here how we can use more than one C++ functions when we make Python bindings. The C++ functions are much faster than the Python implementations. We borrow some ideas from here.

Dependencies

  • C++11
  • pybind11

pybind11 can be installed using:

pip install pybind11

Running Example Code

This module can be compiled and installed using:

pip install -e . -vvv

And you can run this module using:

python main.py