[Numpy-discussion] NumPtr vs NumPy.i to access C
Sat May 17 19:39:58 CDT 2008
On Sat, May 17, 2008 at 6:42 PM, Dag Sverre Seljebotn
> Cython is a different approach from SWIG (see
> http://wiki.cython.org/WrappingCorCpp; in particular SWIG uses more layers
> of indirection).
>From the link:
"[SWIG] Can wrap almost any C and C++ code, including templates etc.
Disadvantage is that it produces a C file, this compiles to .so, but
then it also produces a Python wrapper on top of this .so file. So
it's messy and it's slow. Also SWIG is not only targeting Python, but
other languages as well."
I really wish that people didn't spread FUD about SWIG. For
reference, here's the "messy and slow" Python wrapper for a function
52 def expandptr(*args):
53 """expandptr(int n_row, int Ap, int Bi)"""
54 return _csr.expandptr(*args)
I understand that scipy.sparse does not use all features of SWIG
(which may produce uglier wrappers), but I think the above case is a
fair example of what to expect when wrapping typical C/C++ libraries.
More disingenuous FUD here: http://www.sagemath.org/doc/html/prog/node36.html
Nathan Bell firstname.lastname@example.org
More information about the Numpy-discussion