[Numpy-discussion] NumPy, Numeric or numarray or all of them?

Sasha ndarray at mac.com
Thu May 11 10:15:02 EDT 2006


On 5/11/06, Christopher Barker <Chris.Barker at noaa.gov> wrote:

> [...]
> > or to stay with Numeric for a while (e.g. 1 year). There is also idea to support both
> > packages.
>
> That's a reasonable option as well. In fact, the APIs are pretty darn
> similar. Also, keep in mind that if you go exclusively to numpy, the
> newest version of Numeric will still work well with it. The conversion
> of numpy to Numeric arrays is very efficient, thanks to them both using
> the new "array protocol". Same goes for numarray.

I have started using the array protocol recently, and it is very
useful.  It allows you to eliminate compile time dependency on any of
the particular array package from your extension modules.  If your
package already has an array-like object, that object should provide
an __array_struct__ attribute and that will make it acceptable to
asarray method from any of the latest array packages (numpy, numarray,
or Numeric). If you have functions that take array as arguments they
should be modified to accept any object that has __array_struct__.




More information about the NumPy-Discussion mailing list