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

Mark Evans lists at UltimateG.com
Sat Sep 14 21:15:58 CEST 2002


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.

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 two
approachs *in the context of weave*, then its worth considering a
change.  I'm happy to look at an experimental patch. :-)

eric





More information about the Cplusplus-sig mailing list