~/talk

Go(lang) to Python

Talkat EuroPython 2019 · 2019-07-08..07-14· [python, go]
slides:none on file

Shows how to expose Go code as a Python extension by building a C archive with CGo + Cython, using a handle-to-pointer registry (integer IDs) to keep Go objects live, a small C wrapper layer for C++ vectors/maps, and a C function trampoline for Python callbacks. Implements object creation, methods, string and map return types, and ownership via maps. Benchmarks build 4,000 persons with ~50 friends each (4000 persons / 50 friends) and finds call overhead so high that many Python→Go accessors beat an equivalent Go-side string assembly. Code is ~130 lines Go plus CGo/C/C++ glue and minimal Cython.

AI-written summary · about

  1. 0:00Introduction and goals
  2. 4:48Understanding cgo
  3. 7:10Architecture overview
  4. 9:49Wrapping a simple function
  5. 14:11Sharing objects and state
  6. 23:06Cython integration
  7. 30:40Complex data structures
  8. 35:43Error handling strategies
  9. 37:42Implementing callbacks
  10. 42:12Performance and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.