[Numpy-discussion] NumArray - take method

Colin J. Williams cjw at sympatico.ca
Sat Dec 11 08:20:00 EST 2004


Timo Korvola wrote:

>"Colin J. Williams" <cjw at sympatico.ca> writes:
>  
>
>>I had expected a rank of zero and an indeterminate shape.
>>    
>>
>
>Rank zero would imply shape () and that the result is a scalar.  Empty
>arrays have positive rank but one or more of the dimensions are zero.
>It seems that there is a bug in repr as it does not distinguish
>between empty arrays of different shapes.
>  
>
Perhaps the problem is in str:
 >>> b= a[:,1:1]
 >>> b.shape
(3, 0)
 >>> str(b)
'[]'
 >>> repr(b)
'array([])'

>The current behaviour is consistent in the sense that indexing by a
>slice does not change rank, not even if the slice has length zero or
>one (a slice of length one is thus different from an integer).  Only
>the indexed dimension changes.
>
>  
>
Yes, you are right.

The new docs are a great step forward but it would be good to include 
the take method.

Colin W.





More information about the NumPy-Discussion mailing list