FW: [Numpy-discussion] typecodes in numarray

Todd Miller jmiller at stsci.edu
Fri Jan 24 13:56:01 CST 2003


>
>
>> My current thinking is something like:
>>
>> recarrDescr = {
>>    "name"        : defineType(CharType, 16, ""),  # 16-character String
>>    "TDCcount"    : defineType(UInt8, 1, 0),    # unsigned byte
>>    "ADCcount"    : defineType(Int16, 1, 0),    # signed short integer
>>    "grid_i"      : defineType(Int32, 1, 9),    # integer
>>    "grid_j"      : defineType(Int32, 1, 9),    # integer
>>    "pressure"    : defineType(Float32, 1, 1.),  # float  
>> (single-precision)
>>    "temperature" : defineType(Float64, 32, arange(32)),  # double[32]
>>    "idnumber"    : defineType(Int64, 1, 0),    # signed long long    }
>>
>> where defineType is a class that accepts (type, shape, default) 
>> parameters.
>> It can be extended safely in the future if more needs appear.
>>
> You're way ahead of me here.  The only thing I don't like about this 
> is the additional relative complexity because of the addition of field 
> names and default values.   It would be nice to layer this more. 

One more thing I don't understand looking at this:  a dictionary is 
unordered.

Todd





More information about the Numpy-discussion mailing list