[SciPy-dev] Boost vs CXX and SCXX

eric jones eric at enthought.com
Fri Sep 13 15:53:26 EDT 2002


Hey Mark,

Like you, I'd pick boost or SWIG (which has made *huge* leaps in the
last year for C++ stuff) for wrapping a C++ library.  But that isn't
what we're choosing here.  Weave allows you to inline C++ code within
Python.  It is nice to have a representation of Python objects in the
C++ code that look Pythonic.  C++ classes allow this sort of thing.  

CXX wrappers allowed this sort of thing:

>>> import weave
>>> a= [1,2]
>>> weave.inline('a[0] = Py::Int(3)',['a'])
>>> a[0]
[3, 2]

Now with SCXX, we have:

>>> import weave
>>> a = [1,2]
>>> weave.inline('a[0] = PWONumber(3);',['a'])
>>> a
[3, 2]

I doubt boost would be much different or superior to either of these in
terms of readability or use.

As I said before, most of the tools boost provides help with wrapping
code and aren't beneficial in the context of weave.  All we're looking
for is a few measly classes for wrapping lists, dicts, and tuples --
although callable objects, files, and modules are other potential
targets.  If we can extract these easily from boost, they compile easily
on everything, and they offer some benefits over these other two
approachs *in the context of weave*, then its worth considering a
change.  I'm happy to look at an experimental patch. :-)

eric


> -----Original Message-----
> From: scipy-dev-admin at scipy.net [mailto:scipy-dev-admin at scipy.net] On
> Behalf Of Mark Evans
> Sent: Friday, September 13, 2002 2:01 PM
> To: scipy-dev at scipy.net
> Subject: [SciPy-dev] Boost vs CXX and SCXX
> 
> > My current opinion remains that SCXX is the best fit for what weave
> > needs.  I'd be interested, though, if a boost expert can chime in on
> > what they think is required to extract the list, tuple, dictionary
stuff
> > from boost and whether it is appropriate.
> 
> A couple years ago my company tasked me with an assignment.  I was to
> evaluate C++ interfacing libraries for Python.  At that time Boost was
> still in alpha stages, but after using it, I considered myself very
> fortunate to have found it.  Prior to that, my company and I had sunk
a
> lot of effort into CXX.
> 
> Even in its alpha stages, Boost was a dream compared to CXX, the C
API,
> or any other toolkit.
> 
> My particular project involved an ActiveX chart control interfaced to
> wxPython, and a Python interface to both Mathematica and Numerical
Python.
> We were creating a technical workspace environment with Python as the
> front end and Numpy / Mathematica as cooperating back ends.
> I can't tell you what relief I felt after I switched from CXX to
Boost.
> 
> Boost has a lot of complexity so that your C++ code can remain simple.
It
> minimizes the impact of Python interfacing on C++ code.  Wrapping your
> existing C++ code is trivially simple.  Not so with CXX and kin.
> 
> CXX has a different philosophy, which is to make C++ code read
> like Python code.  About all it really does is to define some C++
> objects that behave like Python atoms.  That's fine as far as it goes
> but offers nowhere near the power of Boost.  Boost does not prohibit
> writing code like that, but does not force it on you.
> 
> Compared to Boost, CXX is pretty dumbed-down, and SCXX even
> more so.  I would hate to see SciPy standardize on either one of them
> especially after my personal experiences "crawling out from under"
> them.  http://www.boost.org/libs/python/doc/comparisons.html
> 
> After two years of development Boost has taken the lead and I would
> consider it folly to adopt any other toolkit for C++ interfacing to
> Python.  (In specialized cases I might use SWIG but otherwise Boost
all
> the way.)  The Boost development is very active whereas CXX and
> kin are as stale as old bread.
> 
> If your Windows compiler is having problems with templates, then try
> the free Digital Mars compiler (DigitalMars.com).
> 
> Mark
> 
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-dev




More information about the SciPy-Dev mailing list