[Numpy-discussion] Question about numarray Bool type

Todd Miller jmiller at stsci.edu
Tue May 6 08:49:03 CDT 2003


Peter Verveer wrote:

>Hi,
>
>In the numarray source code Bool is defined as a typedef to char. Does the 
>Bool array type correspond to the Int8, or the UInt8 type? If I recall 
>correctly, the char type may be signed or unsigned. Can I make any 
>assumptions about the C type used to implement Bool at all?
>
Yes!  It's named Bool.  :)

>I guess at the Python level it does not matter what actual C type is used to 
>implement bool arrays as it only represents boolean values. However, at the 
>level of C extensions I would like to deal with Bool arrays by calling 
>existing functions written for the appropiate C type. 
>
The easiest way now is to just declare your variables with type "Bool". 
 The only thing I can think of which that doesn't cover is printf/scanf. 
  Are there others?

>That would be somewhat 
>simpler if Bool is always garantueed to be either a unsigned or a signed char 
>type. 
>
I think perhaps we should just re-define Bool as signed char.  Any other 
opinions?

>
>Cheers, Peter.
>
>  
>
Todd





More information about the Numpy-discussion mailing list