A Dimecres 01 Octubre 2003 10:57, Marc Poinot va escriure:
Francesc Alted wrote:
from numarray import strings
This solves the python lib problem, but not the API problem. In the API, I've got some arrays, and when I want to store these arrays in CGNS I cannot decide if an UInt32 is a string or not. Then I'll have to manage my string arrays as specific types, but not arrays...
I use something like: isinstance(arr, numarray.strings.CharArray) in my C extensions. I'm using Pyrex to do that and it is responsible to generate the appropriate C code, so, a priori, this is also possible from C.
I'll have to add an attribute to arrays to indicate that it is a string, if so then I should store it in CGNS as C1 array.
That's another possibility
Is there a reason why Char type is not taken into account in numarray ? Well known data representation or storage systems as netCDF or HDF, or even ADF (our CGNS storage system) have a Char type...
In the numarray.records module there is a Char type defined as: class Char: """ data type Char class""" bytes = 1 def __repr__(self): return "CharType" CharType = Char() But this is not defined widely in all the numarray package. Perhaps there is a good reason for not doing that, but I can't figure it now. -- Francesc Alted