So I got the okay to use Python at work! They would like me to write a gui that 'controls' some C++ code. I asked them if I could do it in Python and they said, "do it however you want." Sometimes it's great being a student!
Anyhow, I immediately came across Boost.python. Before I go any further, I thought I'd ask the knowledgeable folks on this list their ideas. So, how would write python code that interfaces with C++? (note: it's on windows in VS2005).
Thanks,
···
--
Michael Kolakowski
CCN-12
505-606-0934
-------------------------------------------------------------------------
'Honest, boss, there's nobody here but us complicated thinking machines.'
Boost.python is fantastic if you're working in an environment where it builds (VS2005 should qualify). It's hands-down the easiest way to provide python interfaces to C++ code. SWIG is ok, but the C++ support isn't fantastic, and it creates wrappers which are often rather un-pythonic in their use on the python side.
SWIG's C++ support is superb with the exception of nested classes. It supports all kinds of templates, stl vectors/strings/maps/lists/... are automatically converted to python lists and vice versa, and there are many more features. In fact it allows you to do much more than Boost.python which can get limited quickly. You can apply custom typemaps and making the interface more pythonic (I don't see why it is not pythonic) is really easy. It supports smartpointers, iterators and various other things; moreover you can have different scripting language backends. That means you can also wrap to c#, java, perl, ruby, tcl and many other languages.