[Numpy-discussion] A proposal for dtype/dtypedescr in numpy objects

Travis Oliphant oliphant at ee.byu.edu
Fri Jan 13 09:38:03 CST 2006

Sebastian Haase wrote:

>Following up: There was never any response to Francesc proposal !
>I thought it sounded pretty good - as he argued: Still a good (late but 
>acceptable) time to clean things up ! 
>(I like just the fact that it removes the "ugly" doubling of having two: 
>arr.dtype and arr.dtypecode )
I think this proposal came during busy times and was not able to be 
looked at seriously.   Times are still busy and so it is difficult to 
know what to do wih it.

I think there is validity to what he is saying.  The dtypedescr was only 
added in December while the dtype was there in March, so the reason for 
it is historical.

I would not mind changing it so that .dtype actually returned the 
type-descriptor object.  This would actually make things easier.   It's 
only historical that it's not that way.

One issue is that .dtypechar  is a simple replacement for .typecode()  
but .dtype.char would involve two attribute lookups which may not be a 
good thing.  But, this might not be a big deal because they should 
probably be using .dtype anyway.

>Is this still on the table !?
I'm willing to look at it, especially since I like the concept of the 
dtypedescr much better.

>>In my struggle for getting consistent behaviours with data types, I've
>>ended with a new proposal for treating them. The basic thing is that I
>>suggest to deprecate .dtype as being a first-class attribute and
>>replace it instead by the descriptor type container, which I find
>>quite more useful for end users. 
I think this is true... I was just nervous to change it.   But, prior to 
a 1.0 release I think we still could, if we do it quickly...

>>The current .dtype type will be still
>>accessible (mainly for developers) but buried in .dtype.type.
>>Briefly stated:
>>current             proposed
>>=======             ========
>>.dtypedescr     --> moved into .dtype
>>.dtype          --> moved into .dtype.type
>>.dtype.dtypestr --> moved into .dtype.str
>>                    new .dtype.name
I actually like this proposal a lot as I think it gives proper place to 
the data-type descriptors. 

I say we do it, very soon, and put out another release quickly.


More information about the Numpy-discussion mailing list