[Numpy-discussion] dtype attribute missing in numarray

Colin J. Williams cjw at sympatico.ca
Thu Jan 5 10:12:09 EST 2006


Sebastian Haase wrote:

>Thanks Todd,
>I like this a lot.  Maybe it could be mentioned in the documention - I don't 
>have any good suggestions on where, I just noticed that 'dtype' is not in the 
>index.
>I assume the following assignment to 'dtype' is not that important !?
>  
>
>>>>na.__version__
>>>>        
>>>>
>'1.5.1'
>  
>
>>>>a = na.arange(10,dtype=na.float32)
>>>>a.dtype
>>>>        
>>>>
>Float32
>  
>
>>>>a.dtype = na.int32
>>>>        
>>>>
>Traceback (most recent call last):
>  File "<input>", line 1, in ?
>AttributeError: can't set attribute
>
>Also: when / why was it decided that dtypes (float32, int32, ...) should be 
>lowercase !? Aren't all python types usually uppercase ...
>
>Thanks for all your work.
>Sebastian Haase
>
>
>
>
>On Thursday 05 January 2006 03:10, Todd Miller wrote:
>  
>
>>Sebastian Haase wrote:
>>    
>>
>>>Hi,
>>>In an effort to follow the scipy_core development I just got the latest
>>>CVS version of numarray.
>>>I was mainly interested in changing my code (and the tutorial that I
>>>write) slowly but surely to use 'dtype' instead of 'type'.
>>>
>>>So I get this:
>>>      
>>>
>>>>>>na.__version__
>>>>>>            
>>>>>>
>>>'1.5.1'
>>>
>>>      
>>>
>>>>>>a = na.arange(10,dtype=na.float32)   # great !
>>>>>>a.dtypechar
>>>>>>            
>>>>>>
>>>'f'
>>>
>>>      
>>>
>>>>>>a.type()
>>>>>>            
>>>>>>
>>>Float32
>>>
>>>      
>>>
>>>>>>a.dtype
>>>>>>            
>>>>>>
>>>Traceback (most recent call last):
>>> File "<input>", line 1, in ?
>>>AttributeError: 'NumArray' object has no attribute 'dtype'
>>>
>>>Is there a reason for not having the 'dtype' attribute !? I *really* never
>>>liked the need for parenthesis when using 'a.type()' ...
>>>
>>>Thanks,
>>>Sebastian Haase
>>>      
>>>
>>I added .dtype returning the numarray numerical type object
>>corresponding to the array.
>>
>>Todd
>>    
>>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
>for problems?  Stop!  Download the new AJAX search engine that makes
>searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
>_______________________________________________
>Numpy-discussion mailing list
>Numpy-discussion at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>
>  
>
dtype is an improvement.  The use of type created confusion.

Colin W.




More information about the NumPy-Discussion mailing list