[Numpy-discussion] Bug: extremely misleading array behavior
Konrad Hinsen
hinsen at cnrs-orleans.fr
Wed May 29 01:13:03 EDT 2002
Pearu Peterson <pearu at cens.ioc.ee> writes:
> an array with 0 rank. It seems that the Numeric documentation is missing
> (though, I didn't look too hard) the following rules of thumb:
>
> If `a' is rank 1 array, then a[i] is Python scalar or object. [MISSING]
Or rather:
- If `a' is rank 1 array with elements of type Int, Float, or Complex,
then a[i] is Python scalar or object. [MISSING]
- If `a' is rank 1 array with elements of type Int16, Int32, Float32, or
Complex32, then a[i] is a rank 0 array. [MISSING]
- If `a' is rank > 1 array, then a[i] is a sub-array a[i,...]
The rank-0 arrays are the #1 question topic for users of my netCDF
interface (for portability reasons, netCDF integer arrays map to
Int32, not Int, so scalar integers read from a netCDF array are always
rank-0 arrays), and almost everybody initially claims that it's a bug,
so some education seems necessary.
Konrad.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron | Fax: +33-2.38.63.15.17
45071 Orleans Cedex 2 | Deutsch/Esperanto/English/
France | Nederlands/Francais
-------------------------------------------------------------------------------
More information about the NumPy-Discussion
mailing list