[Numpy-discussion] Avoiding array-scalar arithmetic?

Travis Oliphant oliphant at ee.byu.edu
Thu Sep 14 18:40:56 CDT 2006


Ryan Gutenkunst wrote:

>Hi Travis,
>
>Travis Oliphant wrote:
>  
>
>>Ryan Gutenkunst wrote:
>>    
>>
>>>I notice that numpy_array.item() will give me the first element as a 
>>>normal scalar. Would it be possible for numpy_array.item(N) to return 
>>>the Nth element of the array as a normal scalar?
>>>  
>>>      
>>>
>>Now this is an interesting idea.  It would allow you to by-pass the 
>>slow-indexing as well as the array scalar computation should you desire 
>>it.  I like it and am going to add it unless there are convincing 
>>objections.
>>
>>-Travis
>>    
>>
>
>Thanks for the quick response, but either there's a bug, or I'm using 
>things wrong. It appears to work to work in the N-D case, but not 1-D. I 
>looked at the change you made, but my grasp of the C-API is too weak to 
>isolate the problem.
>  
>
It's a silly bug.  Please check out the latest SVN.

-Travis





More information about the Numpy-discussion mailing list