[SciPy-dev] [Numpy-discussion] Records in scipy core

Travis Oliphant oliphant.travis at ieee.org
Fri Dec 2 13:11:17 CST 2005

Stephen Waterbury wrote:

>Travis Oliphant wrote:
>>So, I've been re-thinking the notion of "registering a data-type".  It 
>>seems to me that while it's O.K. to have a set of pre-defined data 
>>types.  The notion of data-type ought to be flexible enough to allow the 
>>user to define one "on-the-fly".
>>I'm thinking of ways to do this right now.  Any suggestions are welcome.
>I'm doing that in an application I'm developing.
>My objects have an attribute called '_schema' that is an instance
>of Zope InterfaceClass.  An object (read "record" ;) is assigned a _schema
>when it is instantiated, and all information about its attributes (a.k.a.
>"fields") is contained in the _schema's Properties (my 'Property' subtypes
>the Zope interfaces 'Attribute' type, and has a host of (meta-)attributes
>like 'domain', 'range', 'id', 'name', etc. -- which could easily be
>extended to include things like 'title', but I use another mechanism
>for display characteristics, called 'DisplayMap', which can be used to
>specify the order in which you want the object's properties to appear
>in a grid, what you want their "display names" to be, etc. ... which are
>also customizable by the end-user.
Thanks for the example.  This is exactly what I'm trying to do. 

The difficulty is that the notion of data type is strongly bound in the 
C implementation of scipy core to a type number describing the array 
descriptor.  In fact, currently the C-member of the array object that 
really defines the type is not even a Python object (it's just a 
C-structure).  SciPy Core does a much better job of abstracting the 
notion of type in the code than Numeric did, but it's still got some of 
that type_number specific stuff in it.  It's part of what makes it hard 
to really abstract the idea of data type and still keep the speed of the 
old code-base.

I think I've got some ideas though.  I'm working on them right now.


More information about the Scipy-dev mailing list