3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 11:43:47 +01:00
dft_tools/doc/reference/c++/lectures/patterns/python.rst
Olivier Parcollet f2c7d449cc First commit : triqs libs version 1.0 alpha1
for earlier commits, see TRIQS0.x repository.
2013-07-17 19:24:07 +02:00

58 lines
1.0 KiB
ReStructuredText

Python bindings
#####################
All the idioms that we use from boost.python ....
Introduction to boost.python
==============================
* wrapping versus converting.
Example of wrapping a function, a class, with an array.
Using a more complex converters.
Wrapping enable a converter.
* converting : principle.
Ref to doc.
The simple triqs way to build a converter.
Example of range !
* Passing a pyobject.
* Difference between PyObject* and bpy::object
Reference counting.
* More sophisticated data structure.
* THE TRIQS tools : a thin layer (converter) for recursive conversion
(e.g. vector<T> , unordered_map, ....)
boost.python : a C++ API for python
======================================
Code injection
=================
The problem.
The solution : injection and documentation.
Examples
==========
Passing a dict for parameters in a routine.
Passing a list of gf_view into a vector of gf_view...
---> make it a const vector to avoid changing it....
Other options
==============
* Swig
* Cython