Just to add something from personal experience in case it's useful... I write a lot of code that works on numpy arrays that goes between python and c++ (too used to OO to stick with pure c). I've been using scipy.weave to interface to blitz++ arrays in my c++ code. The blitz++ library has been wonderful in my experience -- it supports arrays up to 11 dimensions, slicing, etc. -- essentially a very useful subset of numpy's operations. It's also nice because it can interface without copying any data; it just provides a wrapper class that sits on a numpy array. The library is included as part of scipy. I recently wrote a function that automatically generates wrappers for a c++ function that accepts blitz++ arrays which I recently posted to the scipy list. You just specify function names and the list of argument types (nparrays included) and it generates the wrapper code. Quite easy. It's pertinent to the discussion here, so I'll send it again. Included is a full working example with setup.py. let me know if it helps/is confusing/doesn't work/etc. --Hoyt On Wed, Apr 23, 2008 at 12:30 PM, Andreas Klöckner <lists@informa.tiker.net> wrote:
On Mittwoch 23 April 2008, Christopher Barker wrote:
NOTE: Most folks now think that the pain of writing extensions completely by hand is not worth it -- it's just too easy to make reference counting mistakes, etc. Most folks are now using one of:
Cython (or Pyrex) SWIG ctypes
IMO, all of these deal better with C than they do with C++. There is also a number of more C++-affine solutions:
- Boost Python [1]. Especially if you want usable C++ integration. (ie. more than basic templates, etc.)
- sip [2]. Used for PyQt.
Andreas
[1] http://www.boost.org/doc/libs/1_35_0/libs/python/doc/index.html [2] http://www.riverbankcomputing.co.uk/sip/index.php
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
-- +++++++++++++++++++++++++++++++++++ Hoyt Koepke UBC Department of Computer Science http://www.cs.ubc.ca/~hoytak/ hoytak@gmail.com +++++++++++++++++++++++++++++++++++