C/C++ and Python

Python, with its many advantages, is still by most standards considered a slow language. Any operation that is computationally intensive requires the program to be as fast as possible to keep the computational time to a minimum. To this extent, one can use a wrapper between Python and C/C++: The computational bottlenecks can be addressed in C/C++, while everything else can be done in Python.

Course Content

In this course we will give an introduction to Swig in Python. We will go through how header files in C++ can be used to create a connection to create modules in Python. The course will also show how to integrate other languages as well.

Prerequisite

This course requires some familiarity with the C++ programming language, introduced here.

This course requires some familiarity with the Python programming language, introduced here.

Duration: 1 hours

Tools Introduced

Swig
Simplified Wrapper and Interface Generator (SWIG) is an open-source software tool used to connect computer programs or libraries written in C or C++ with scripting languages such as Python. SWIG will compile an interface file and generate code in regular C/C++ and the target programming language through shared libraries.