[Numpy-discussion] boolean arrays

Fabrice Silva silva@lma.cnrs-mrs...
Thu Nov 26 08:14:04 CST 2009


Le jeudi 26 novembre 2009 à 14:44 +0100, Gael Varoquaux a écrit :
> On Thu, Nov 26, 2009 at 02:43:14PM +0100, Fabrice Silva wrote:
> > Le jeudi 26 novembre 2009 à 18:26 +0200, Nadav Horesh a écrit :
> > > It is obvious to me that True+False == True,. Why do you think it should
> > > be False?
> 
> > I would understand it is not obvious that '+' stands for logical 'or',
> > and '*' for logical 'and'...
> 
> In Bool's algebra, this is the common convention. The reason being that
> only 'or' can correspond to the additive law of an algebra: its null
> element is absorbant for 'and'.
> 
> In other words, if you map '+' and '*' to the opposite, you'll get
> suprising behaviors.

I fully agree with you. My point was to complete Nadav's comment with
potentially missing information, trying to figrue why Nils was expected
False...

-- 
Fabrice Silva <silva@lma.cnrs-mrs.fr>
LMA UPR CNRS 7051



More information about the NumPy-Discussion mailing list