[C++-sig] Weave Scipy Inline C++

eric jones eric at enthought.com
Sun Sep 15 01:01:05 CEST 2002

Hey Mark,

> http://www.scipy.org/site_content/weave
> Can Boost do anything like this?  These folks are planning to use SCXX
> while I am trying to get them to use Boost Python for C++ interfacing.
> They keep talking about Pythonic C++ classes, but I think that
> limiting inline C++ to such classes will severely limit Weave.

What is this "severe limitation"?  I just don't understand.  Do you have
a use case to help me out here?

We have a very light weight need -- making dicts, tuples, and lists easy
to use in C++ so that inline C++ code looks as much like Python as
possible.  This is about 0.3% of boost's capabilities.  On the other
hand, it uses about 95% of SCXX capabilities which means it is a good
fit.  SCXX is 900 lines of code and easy to port anywhere.

If you need the other 99.7% of boost's capabilities, then you probably
need to be using boost instead of weave anyhow.  They serve different
purposes.  Weave is generally suited for light weight wrapping and
speeding up computational kernels with minimum hassle -- especially in
numeric codes where Numeric isn't fast enough.  

Oh, and I'm happy to except patches that allow for boost type converters
in weave (they should, after all, be easy to write).  Then you can use
boost instead of SCXX.


> Their statement is:
> Message: 5
> From: "eric jones" <eric at enthought.com>
> To: <scipy-dev at scipy.net>
> Subject: RE: [SciPy-dev] Boost vs CXX and SCXX
> Date: Fri, 13 Sep 2002 14:53:26 -0500
> Reply-To: scipy-dev at scipy.net
> 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
> approachs *in the context of weave*, then its worth considering a
> change.  I'm happy to look at an experimental patch. :-)
> eric
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig

More information about the Cplusplus-sig mailing list