[Numpy-discussion] Array Interface (original) (raw)
Travis Oliphant oliphant at ee.byu.edu
Thu Jun 8 18:22:47 EDT 2006
- Previous message (by thread): [Numpy-discussion] Intel OSX test failure
- Next message (by thread): [Numpy-discussion] Array Interface
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thanks for the continuing discussion on the array interface.
I'm thinking about this right now, because I just spent several hours trying to figure out if it is possible to add additional "object-behavior" pointers to a type by creating a metatype that sub-types from the Python PyType_Type (this is the object that has all the function pointers to implement mapping behavior, buffer behavior, etc.). I found some emails from 2002 where Guido indicates that it is not possible to sub-type the PyType_Type object and add new function pointers at the end without major re-writing of Python.
The suggested mechanism is to add a CObject to the tp_dict of the type object itself. As far as I can tell is equivalent to what we are doing with adding the array interface as an attribute look-up.
In trying to sell the array interface to the wider Python community (and get it into Python 2.6), we need to simplify the interface though. I no longer think having all of these attributes off the object itself is a good idea (I think this is a case where flat is not better than nested).
It turns out that the array_struct interface is the really important one (it's the one that numarray, NumPy, and Numeric are all using). So, one approach is to simply toss out support for the other part of the interface in NumPy and "let it die."
Is this what people who opposing using the array_struct attribute in a dualistic way are suggesting? Clearly some of the attributes will need to survive (like array_descr which gives information that array_struct doesn't even provide). A big part of the push for multidimensional arrays in Python is the addition of the PyArray_Descr * object into Python (or something similar). This would allow a way to describe data in a generic way and could change the use of array_descr. But, currently the array_struct attribute approach does not support field-descriptions, so array_descr is the only way.
Please continue offering your suggestions...
-Travis
- Previous message (by thread): [Numpy-discussion] Intel OSX test failure
- Next message (by thread): [Numpy-discussion] Array Interface
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]