[Numpy-discussion] Array values sometimes have "<type 'array'>"

Edward C. Jones edcjones at erols.com
Thu May 31 13:46:07 EDT 2001


I use Numeric 20.0.0, Python 2.1, and RedHat 7.1 on a PC.

Here is a small Python program:

import Numeric

a = Numeric.zeros((2,2), 'b')
print a[0,0], type(a[0,0])
print a[0][0], type(a[0][0])

a = Numeric.zeros((2,2), 'i')
print a[0,0], type(a[0,0])
print a[0][0], type(a[0][0])

a = Numeric.zeros((2,2), 'f')
print a[0,0], type(a[0,0])
print a[0][0], type(a[0][0])

The output is:

0 <type 'array'>
0 <type 'int'>
0 <type 'array'>
0 <type 'int'>
0.0 <type 'array'>
0.0 <type 'float'>

This can't be correct. "a[0,0]" and "a[0][0]" should have the same type. A quick
check of my old Python code shows that this
problem may have appeared since Numeric version 17.

Thanks,
Ed Jones






More information about the NumPy-Discussion mailing list