Scripting C++ -- Boost.Python vs CORBA vs ???

Donovan Rebbechi elflord at panix.com
Tue Feb 26 14:21:10 EST 2002


In article <3C7283E4.4050604 at physics.ucsb.edu>, Craig Maloney wrote:
> 
> Hi all.
> 
> I'm doing some scientific computing and have
> amassed a moderate set of classes.  Due to the
> heavy computational demands, I don't think I
> can justify rewriting everything in an interperated
> language; nice as that would be now that I'm
> playing around with what I've created.
> 
> I'm in a situation now where I've written about
> a dozen of quickie, throw away, utility routines
> that I call from the command line, and in essence,
> BASH has become my scripting environment.
> 
> Unfortunately, the number of throw-away routines
> is exploding, and I feel like I'm loosing the advantage
> of having constructed a nice set of classes with
> which to play.
> 
> I would, of course, like to have some sort of scripted
> environment (e.g. Python) in which to "play"
> with my objects.
> 
> That said, I'd like to solicit opinions as to the relative
> merits of the various possible approaches.
> 
> I'm making essential use of templates and polymorphism.
> 
> I have no experience with Boost.Python, but from what I
> understand, it would not involve writing wrapper definitions
> (ala SWIG or IDL), right?  Are there other options?

I've been in a similar situation to you -- I'm writing library code and
utilities that use a lot of numerical algorithms. Having an interpreted 
environment is indeed extremely useful and convenient. Python also has the
added advantage that the user shell is first rate -- it includes online
help, runtime module loading, and the same sort of command history and command
line editing features as bash has.

One approach I found useful was functional programming -- you hand a range 
and a function object to C++, and use the speed of C++ to your advantage.

The tool I've used is Sip. It automatically (or close to) produces C++ 
bindings for Python, in much the same way as SWIG produces C bindings. From
my point of view, the main advantage of Sip is that it's also the 
implementation kit for PyQt, and I'm using a lot of Qt in my C++ work.

Cheers,
-- 
Donovan



More information about the Python-list mailing list