[Numpy-discussion] Numeric/numarray compatibility issue

Todd Miller jmiller at stsci.edu
Fri Mar 4 11:44:40 EST 2005

On Fri, 2005-03-04 at 13:50, Perry Greenfield wrote:
> On Mar 4, 2005, at 1:24 PM, konrad.hinsen at laposte.net wrote:
> > What is actually the difference between Bool and Int8?
> >
> I'm not sure I remember all the differences (Todd can add to this if he 
> remembers better). Booleans are treated differently as array indices 
> than Int8 arrays are. The machinery of generating Boolean results is 
> different in that it forces results to be either 0 or 1.

Conversions to Bool, logical operations, and (implicitly) comparisons
constrain values to 0 or 1.  

>  In other 
> words, Boolean arrays should only have 0 or 1 values in those bytes 
> (not that it isn't possible for someone to break this in C code or 
> though undiscovered bugs. Ufuncs that generate different values such as 
> arithmetic operators result in a different type.

More general arithmetic appears to have unconstrained results.

More information about the NumPy-Discussion mailing list