Sessions at EuroPython 2012 about C++ on Tuesday 3rd July

Python has great support for interfacing with C/C++ code, and this has been used to great advantage by exposing many C/C++ libraries as Python modules. In this talk, I will reverse the equation. I will show you how you can - and why you might want to - build C++ APIs on top of Python modules and use them directly from your C++ programs.

The topics will include:

Conversion of types across the language boundary.

Implementation of C++ idioms (e.g. the begin()/end() iterator API) on top of Python idioms.

Python runtime management: initialization, module loading, etc.

Working with the “impedance mismatches” between the languages (e.g. duck-typing vs. static typing)

I will also discuss the reasons why C++ APIs on Python code represent a very useful and often powerful technique. The reasons range from simple pragmatism (you want to use an existing Python module in an existing C++ program) to productivity (writing Python code plus a C++ wrapper can be easier and faster than writing pure C++.)