[Numpy-discussion] Records in scipy core

Colin J. Williams cjw at sympatico.ca
Fri Dec 2 12:12:09 EST 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.
> Let me know if this sounds interesting.
> Cheers,
> Steve

This is goes further than my suggestion.  For arrays, it seems to me 
that an additional pointer to _schema is not needed as there is a 
pointer to the data type and the data type can contain the meta data

Colin W.

More information about the NumPy-Discussion mailing list