From: Francesc A. <fa...@ca...> - 2005-05-12 11:39:08
|
A Dijous 12 Maig 2005 09:16, v=E0reu escriure: > No. The contrary. In my opinion, python integers and float should be > pickled. > Numarray objects, including scalars, should be saved as numeric HDF5 > attributes. > In this way numeric HDF5 attributes will be *always* loaded into pytables > as numarray objects, and numarray objects will be *always* saved on file = as > numeric > HDF5 attributes (H5T_NATIVE_INT, H5T_NATIVE_FLOAT and so on). > Python objects, including int, float, complex, decimal.Decimal, list, > tuple, dict, etc, should be saved as cpickle strings in order to not have > ambiguities with > numeric attributes. > In this way you can write code like this > > leaf.attrs.uchar =3D na.array(1, type=3Dna.UInt8) # --> H5T_NATIVE_UCHAR > integet =3D 1 > leaf.attrs.int =3D integer # --> cpickle string > leaf.attrs.int32 =3D na.asarray(integer) # --> H5T_NATIVE_INT > > and then retrieve them back unambiguously. > Stated that extra code is needed in order to preserve the compatibility > with old pytables version, I don't know if this approach can araise other > problems. > I hope I have not been too much confusing. No, I understand clearly now. Well, after discussing this issue with Ivan, we think that your suggestion is very consistent. And, as we can distinguish between files made with PyTables 1.0 and earlier from those made with PyTables 1.1 and after, I think there will be no problem in implementing that. May you provide the necessary patch based on the latest snapshot? If you can't, I can do it my self. Thanks, =2D-=20 >0,0< Francesc Altet =A0 =A0 http://www.carabos.com/ V V C=E1rabos Coop. V. =A0=A0Enjoy Data "-" |