[Numpy-discussion] Boolean array formatting poll

Robert Kern kern at caltech.edu
Thu Sep 11 17:55:29 EDT 2003


On Tue, Sep 09, 2003 at 04:15:36PM -0400, Todd Miller wrote:
> Now that Python has a bool type, I have received a patch for numarray's
> arrayprint module which alters the formatting of Boolean arrays from:
> 
> >>>> a=numarray.arange(6, type=numarray.Bool); a[::2] = 0; a
> array([0, 1, 0, 1, 0, 1], type=Bool)
> 
> to:
> 
> >>>> a=numarray.arange(6, type=numarray.Bool); a[::2] = 0; a
> array([False, True, False, True, False, True], type=Bool)
> 
> Which format do you prefer?   Please vote for or against changing the
> format:  +1 (for)  or -1 (against).

-1

If I'm using those kinds of values in arrays, I'm more likely to be
thinking in terms of 1's and 0's not True's and False's anyways.

E.g.

frequency = float(sum(a)) / len(a)

-- 
Robert Kern
kern at caltech.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the NumPy-Discussion mailing list