.. blogpost:: :title: cppyy: a new module for to C++ in python :keywords: C++, cppyy, clang, cling :date: 2019-09-25 :categories: C++ I did not try but the approach seems interesting and less verbose than any others. `cppyy `_ uses `cling `_ to extend Python code with C++ code during the execution. The `tutorial `_ contains the following example: :: >>> import cppyy >>> cppyy.cppdef(""" ... class MyClass { ... public: ... MyClass(int i) : m_data(i) {} ... virtual ~MyClass() {} ... virtual int add_int(int i) { return m_data + i; } ... int m_data; ... };""") True >>> from cppyy.gbl import MyClass >>> m = MyClass(42) >>> cppyy.cppdef(""" ... void say_hello(MyClass* m) { ... std::cout << "Hello, the number is: " << m->m_data << std::endl; ... }""") True >>> MyClass.say_hello = cppyy.gbl.say_hello >>> m.say_hello() Hello, the number is: 42 >>> m.m_data = 13 >>> m.say_hello() Hello, the number is: 13