[Numpy-discussion] Anyone have a well-tested SWIG-based C++ STL valarray <=> numpy.array typemap to share?

David M. Cooke cookedm@physics.mcmaster...
Fri Sep 7 09:03:47 CDT 2007


Christopher Barker <Chris.Barker@noaa.gov> writes:

> Joris De Ridder wrote:
>> A related question, just out of curiosity: is there a technical  
>> reason why Numpy has been coded in C rather than C++?
>
> There was a fair bit of discussion about this back when the numarray 
> project started, which was a re-implementation of the original Numeric.
>
> IIRC, one of the drivers was that C++ support was still pretty 
> inconsistent across compilers and OSs, particularly if you wanted to 
> really get the advantages of C++, by using templates and the like.
>
> It was considered very important that the numpy code base be very portable.

One of the big problems has always been that the C++ application
binary interface (ABI) has historically not been all that stable: all
the C++ libraries your program used would have to be compiled by the
same version of the compiler. That includes Python. You couldn't
import an extension module written in C++ compiled with g++ 3.3, say,
at the same time as one compiled with g++ 4.0, and your Python would
have to been linked with the same version.

While the ABI issues (at least on Linux with GCC) are better now, it's
still something of a quagmire.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm@physics.mcmaster.ca


More information about the Numpy-discussion mailing list