From: Francesc A. <fa...@op...> - 2003-01-27 20:15:08
|
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 conside= r > > 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 =3D defineType(CharType, 2, default=3D"", position=3D1) field2 =3D defineType(Int32, 1, position=3D2) field3 =3D Float64 as as container for recarray metadata is definitely possible instead of t= he tuple (formats=3D"2aid",names=3D("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 one= s 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, --=20 Francesc Alted |