[Numpy-discussion] Numpy 1.6 schedule

Christopher Barker Chris.Barker@noaa....
Mon Mar 7 11:08:24 CST 2011


On 3/6/11 5:54 AM, Charles R Harris wrote:
> I suppose this might cause a problem with lazy/quick c extensions that
> expected elements in a certain order, so some breakage could occur.

absolutely!

(I've gotten a bit confused about this thread, but if this is about the 
question of whether structured dtypes are dtypes are assumed to always 
keep order, read on -- otherwise, ignore)..

I have always assumed a structured dtype was much like a C struct: i.e. 
arrangement in memory is fixed, and the named fields are just for 
convenience.

I was very surprised to learn that they could ever be used in more a a 
dict-like manner.

Also, I noted a recent post to this list suggesting that folks sometime 
miss-use stuctured arrays (particularly folks coming from MATLAB, etc), 
by using them when what they really want is a dict. In that post, the 
poster suggested that the primary use of structured arrays was for 
interacting with data files and C code that has arrays of structures, 
and indeed, that is how I have primarily used them.

So I think for performance and consistency with C code, keeping dtype 
order is the best way to go. If that breaks backward compatibility too 
much, then it shouldn't be changed, but I think it better reflects what 
dtypes are all about.

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list