[Numpy-discussion] Accessing rank-0 array value?

Peter Verveer verveer at embl-heidelberg.de
Mon Jun 7 09:35:01 CDT 2004


I do not agree. The a[()] notation is consistent and clear if you know 
that you can index with a tuple of indices: you index a rank-0 array 
with a tuple of length zero.

The "..." and ":" should do the same as for any other array: return the 
whole thing, not a single element.

On 7 Jun 2004, at 18:27, Francesc Alted wrote:

> First of all, thanks to everybody for their responses.
>
> For me, the basic problem is that a[()] notation would be the best way 
> to
> get the python object with a type close to that of the numarray 
> object. Why
> not letting a[...] or a[:] to return the same object as a[()]?. I know 
> that
> this is not consistent with the "..." or ":" use in non-scalar arrays, 
> but I
> find any of last two far more intuitive than a "()" index.
>
> Besides, IMHO, an scalar array is not a "regular" array, so the 
> consistency
> restrictions should not be set as hard as they are now.
>
> Regards,
>
> -- 
> Francesc Alted
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: GNOME Foundation
> Hackers Unite!  GUADEC: The world's #1 Open Source Desktop Event.
> GNOME Users and Developers European Conference, 28-30th June in Norway
> http://2004/guadec.org
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion





More information about the Numpy-discussion mailing list