On 7/7/07, Timothy Hochberg <[EMAIL PROTECTED]> wrote:



On 7/7/07, Travis Oliphant <[EMAIL PROTECTED]> wrote:
>
>
> >
> >
> > On 7/6/07, *Travis Oliphant* <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >


<snip>

Here is a link to PEP 285 <http://www.python.org/dev/peps/pep-0285/> where
Guido discusses his reasoning about the bool type. I note that boolean
arrays behave as integers under addition of a scalar, but not under addition
of boolean arrays, where '+' seems to mean 'or'.  The latter looks
inconsistent with the Python convention.

In [60]: a
Out[60]: array([ True,  True,  True,  True], dtype=bool)

In [61]: a + a
Out[61]: array([ True,  True,  True,  True], dtype=bool)

In [62]: a + 1
Out[62]: array([2, 2, 2, 2])

In [66]: True + True
Out[66]: 2

Now might be a good time to discuss and document these choices.

Chuck
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to