[Numpy-discussion] Records in scipy core

Stephen Waterbury golux at comcast.net
Fri Dec 2 12:32:00 EST 2005


Colin J. Williams wrote:
> Stephen Waterbury wrote:
>> 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.
> 
> 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

In effect, the _schema *is* the data type in my scenario.
It contains all information necessary to describe the type
of the object and references to the types of all the
object's attributes (which are called "fields" in record
parlance, "Properties" in the world of ontologies, and
"Attributes" in Zope Interfaces and UML terminology).

Steve




More information about the NumPy-Discussion mailing list