[C++-sig] new to python; old to C++

David Abrahams dave at boostpro.com
Sun Nov 2 14:11:48 CET 2008

on Sat Nov 01 2008, Paul Melis <paul-AT-pecm.nl> wrote:

> Gustavo Carneiro wrote:
>>     There's an interesting question about whether it's better to use
>>     boost.python or SWIG. I've been using boost.python for years, so I
>>     have a lot invested in it, but if I were starting from scratch, I
>>     might consider using SWIG because it gives you the flexibility to
>>     generate wrappers for languages other than Python.
>> On the other hand, SWIG generates ugly and inneficient code, at least
>> for the Python case.
> I'd like to see proof of the claim that SWIG's wrapper code is
> inefficient. In my experience it is not more inefficient than what, for
> example, boost.python via Py++ provides.

I doubt that SWIG generates less efficient code.  However, I would be
surprised if SWIG's is as careful about dealing with lifetime and
ownership issues that are crucial to writing Pythonic and un-crashable
bindings as Boost.Python is.

Dave Abrahams
BoostPro Computing

More information about the Cplusplus-sig mailing list