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

Stephen Waterbury golux at comcast.net
Fri Dec 2 13:00:35 CST 2005


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




More information about the Scipy-dev mailing list