FW: [Numpy-discussion] typecodes in numarray

Francesc Alted falted at openlc.org
Mon Jan 27 12:16:02 EST 2003

A Dilluns 27 Gener 2003 20:52, Todd Miller va escriure:
> >
> >Oh!, I didn't know that. In such a case, I think it's worth to consider
> > the possibility to define records as classes descendants from
> > metaclasses. But, of course, you have the ultimate decision.
> I don't know what you mean here.   Please spell it out a little more.

I was trying to mean that using something like :

class Small(IsRecord):
    field1 = defineType(CharType, 2, default="", position=1)
    field2 = defineType(Int32, 1, position=2)
    field3 = Float64

as as container for recarray metadata is definitely possible instead of the
tuple (formats="2aid",names=("field1","field2", "field3")), if using
Python2.2. IsRecord is a metaclass (introduced in Python 2.2) that allows
you to effectively separate the declared attributes from the implicit ones
in normal classes.

Of course, you can taylor IsRecord so as to fulfill your needs.

I hope that I have expressed myself more clearly now,

Francesc Alted

More information about the NumPy-Discussion mailing list