[SciPy-dev] Feedback and help on what to do with flexible arrays and arithmetic operations

Travis Oliphant oliphant at ee.byu.edu
Wed Nov 2 16:19:20 CST 2005

Currently arrays of Flexible type (string, unicode, and void) are not 
supported by universal functions, and therefore arithmetic operations on 
arrays of these types are not supported.

However, it seems that it would be useful to support certain arithmetic 
operations for at least the string and unicode types.

I can see at least three general ways to do this with various consequences:

1) Create a separate string array class similar to numarray that 
inherits from the ndarray but adds support for the arithmetic opertions.

    a) Support unicode arrays with the same string array
    b) Have a separate unicode array class.

This is the easiest for me.  Is having a separate string array class a 

2) Adapt ufuncs so that support can be added
       for the flexible arrays on a ufunc by ufunc basis
       as appropriate.

In principle this could be done and would provide a more complete 

3) Place a check in array_add and friends in arrayobject.c for the 
flexible types and call a separate function.

    a) Fix this specifically in code
    b) Allow a general mechanism that allows users to add
         their own funcion for array operations on a specific
         type -- This could get messy with coercion issues.

I think I like option 2 the best, I suppose, but it would take a bit 
more work than option 1. 



More information about the Scipy-dev mailing list