Learn · CERN

Talk34 min

PyROOT: Seamless Melting of C++ and Python

Pere Mato Vila · CERN

Watch At CERN

About

With ROOT it's possible to use any C++ library from Python without writing any bindings nor dictionaries: loading the library and injecting the relevant headers in the ROOT C++ interpreter is enough to guarantee interactive usage from within Python. Just in time (JIT) compilation of C++ code and immediate utilisation of C++ entities from within Python is also supported.

Thanks to the ROOT type system and C++ interpreter and JIT compiler, complete Python/C++ interoperability is achieved. In this contribution we explain how this mechanism is general enough to make any library written in C or C++ usable from within Python and how concepts such as template metaprogramming are mapped in Python. We review the basics of the JIT compilation capabilities provided by the Clang based ROOT interpreter, Cling, and the way in which some of the information of the Abstract Syntax Tree (AST) built by Clang is stored by the ROOT type system. The way in which ROOT manages the automatic loading of libraries and parsing of necessary headers is also described. We illustrate from the programming model point of view the simplicity of the invocation of the C++ entities from within the Python world through concrete examples.

Live demos are provided whenever possible to grant the audience an enhanced experience..

0:00:00 Slide 1

0:00:16 Slide 2

0:00:46 Slide 3

0:02:00 Slide 4

0:04:19 Slide 5

0:05:06 Slide 6

0:07:14 Slide 7

0:08:36 Slide 8

0:09:25 Slide 9

The talk

  1. PyROOT: Seamless Melting of C++ and Python 2016-05-30 · 34 min · CERN's player

Credits and licence

Institution
CERN
Department
Developers@CERN Forum
Speaker
Pere Mato Vila
Year
2016
Language
English
Source
CERN
Licence
CERN, as CERN states it. CERN's terms
Attribution
© CERN. CERN provides its audiovisual media free of charge for educational and informational use, credited to CERN; this lecture is shown in CERN's own player.
Who can watch
CERN gives no rating. Invisible Network shows it to Teens profiles and older, judged from what the source says about it. How courses are placed