[Numpy-discussion] Re: Trying out Numeric3

Stephen Walton stephen.walton at csun.edu
Sat Mar 26 12:19:21 CST 2005


Scott Gilbert wrote:

>It's nice because it fits with the rest of the array semantics and creates
>a consistant system:
>
>    Array3D = zeros((1, 1, 1))
>
>    Array2D = Array3D[0]
>    Array1D = Array2D[0]
>    Array0D = Array1D[0]
>  
>
Hmm...in both Numeric3 and numarray, the last line creates a Python 
scalar.  Array2D and Array1D by contrast are not only arrays, but they 
are views of Array3D.  Is what you're saying is that you want Array0D to 
be a rank-0 array after the above?

>    Array0D[()] = 1
>  
>
Of course, this generates an error at present:  "TypeError: object does 
not support item assignment" since it is a Python int.  Moreover, it 
isn't a view, so that Array0D doesn't change after the assignment to 
Array3D.  Is this also slated to be changed/fixed using rank 0 arrays?  
Would Array0D.shape be () in that case?






More information about the Numpy-discussion mailing list