[C++-sig] Presenting a Python embedding tutorial for Boost.Python

David Abrahams dave at boost-consulting.com
Sun Dec 8 22:59:49 CET 2002

Dirk Gerrits <dirk at gerrits.homeip.net> writes:

> I've finally finished the first draft of the embedding tutorial I was
> writing for Boost.Python. I guess I underestimated the task, because
> it took several days longer than I anticipated, but here it is:
> http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/boost-sandbox/boost-sandbox/libs/python/doc/tutorial/doc/embedding.html
> Note that I am neither an experienced writer, nor an experienced
> Pythoneer. Any and all proof reading will be greatly appreciated.

Thanks very much for your efforts!

I have several high-level remarks:

1. Why spend so much time discussing manual reference-counting, if we
   have a better solution?

2. I notice no use of handle_exception(). Boost.Python code can throw
   C++ exceptions which correspond to Python exceptions (e.g. when
   initializing a handle<> from a null pointer), and
   handle_exception() will translate these back into Python
   exceptions... which can finally be printed on the console or
   wherever else you think is appropriate

3. It was always my intention to help people avoid touching PyObject*s
   and the Python 'C' API at all.  Are there any obvious C++
   interfaces that should be added to the library to wrap the
   boilerplate use of the Python 'C' API I see in your examples?

                       David Abrahams
   dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

More information about the Cplusplus-sig mailing list