How are Booleans to be handled?
![](https://secure.gravatar.com/avatar/b24e93182e89a519546baa7bafe054ed.jpg?s=120&d=mm&r=g)
This statement: z= _n.array([True, False, True, True], type= _nt.BooleanType) gives an exception: Traceback (most recent call last): File "<interactive input>", line 1, in ? File "C:\PROGRA~1\Python23\lib\site-packages\numarray\numarraycore.py", line 284, in array type = getTypeObject(sequence, type, typecode) File "C:\PROGRA~1\Python23\lib\site-packages\numarray\numarraycore.py", line 217, in getTypeObject return getType(type) File "C:\PROGRA~1\Python23\lib\site-packages\numarray\numarraycore.py", line 324, in getType raise TypeError("Not a numeric type") TypeError: Not a numeric type If we leave out the type parameter, the array is created with 32 bit words. Colin W.
![](https://secure.gravatar.com/avatar/b24e93182e89a519546baa7bafe054ed.jpg?s=120&d=mm&r=g)
Thanks, I made a guess and chose the wrong one. This is a lot closer to the optimum storage. Colin W. Todd Miller wrote:
On Mon, 2003-08-18 at 15:44, Colin J. Williams wrote:
This statement: z= _n.array([True, False, True, True], type= _nt.BooleanType)
Use type=_nt.Bool here. BooleanType is the class of Bool.
Todd
participants (2)
-
Colin J. Williams
-
Todd Miller