World Congress 2023 • Aug 11, 2023

How to implement convenient Python bindings to C++

Konstantin Bespalov

Integrating strict C++ into Python doesn't have to be sluggish. Master pybind11 to achieve zero-copy NumPy integrations and seamless type hinting. Build high-performance, idiomatic backtesting pipelines.

Pause
Mute Enter Fullscreen
#1 about 4 min

Overview of the derivative pricing library architecture

The context and architecture of a C++ analytical library for pricing foreign exchange derivatives.

#2 about 3 min

Initial bindings using pythonnet and their limitations

Why wrapping a dotnet assembly with pythonnet resulted in poor performance and missing type hints.

#3 about 3 min

Evaluating pybind11 against direct Python C API

How pybind11 reduces boilerplate compared to the native Python C API while supporting function overloading and buffers.

#4 about 2 min

Defining classes and building packages with pybind11

A walkthrough of exposing C++ classes to Python and compiling the extension module.

#5 about 5 min

Adding IDE type hints using stub files

Implementing PEP 484 stub files to enable autocomplete and static type checking in editors.

#6 about 2 min

Simplifying interfaces with C++ variant types

Using variant types and mapping functions to accept simple Python datatypes instead of custom wrapped objects.

#7 about 1 min

Implementing magic methods for Python collections

Enabling native collection behaviors like iteration and membership testing by adding magic methods.

#8 about 2 min

Supporting multiprocessing with custom copyreg pickling

Registering serialization functions via the copyreg module to make C++ objects picklable for multiprocessing.

#9 about 4 min

Summary of Python bindings and audience QA

A review of the pybind11 implementation steps and answers to audience questions on Python extension methodologies.

Matching moments

1:11 min

The expanded CUDA ecosystem and native Python support

Paul Graham Paul Graham · WWC Europe 2026

3:52 min

Bridging Fortran and Python in modern computing

Stephen Jones · Coffee With Developers

1:46 min

Bridging Python prototyping environments and embedded systems languages

Nico Schmidt · LIVE

1:32 min

Evaluating absolute performance thresholds between Python and procedural syntaxes

Paul Graham Paul Graham · LIVE

4:37 min

Simplifying parallel programming with the CUDA ecosystem

Paul Graham Paul Graham · LIVE

1:24 min

Bridging dynamic typing paradigms for Python cross-language libraries

Markus Ziller Markus Ziller · WWC 2024

Upcoming sessions on this topic

Open session

World Congress 2026 North America

Designing APIs That Survive AI Agents at Scale

Phani Pendurthi

Mastercard, Principal Software Engineer

Phani Pendurthi
Open session

World Congress 2026 North America

Beyond Vibe Coding: Using CLI Tools as Your AI Counterpart in Pair Programming

Ron Veen

Java enthusiast and Special agent for Team Rockstars IT

Ron Veen
Open session

World Congress 2026 North America

Give the Agent a Budget, Not a Token

Sachin Malhotra

MTS @Anthropic

Sachin Malhotra
Open session

World Congress 2026 North America

Merging at Scale: From Broken Builds to Green Mainline

Manjari Akella, Preetam Dwivedi

Manjari Akella
Preetam Dwivedi
Open session

World Congress 2026 North America

The MCP haters are half right

Vojta Kopal

Head of Data at Apify

Vojta Kopal
Open session

World Congress 2026 North America

Agents That Own Their Inference: Building Production AI Agents on Dedicated GPUs

Duan Lightfoot

Sr. AI Engineer, Akamai

Duan Lightfoot