On Wednesday, September 3, 2014 7:14:14 AM UTC+5:30, Steven D'Aprano wrote: > Grant Edwards wrote:
> > I missed the beginning of the thread, but Why are you comparing things > > to True and False? > I don't understand why people do it, but it's *incredibly* common. A couple > of weeks ago at work, I had to (gently, in a friendly manner) mock one of > our most senior and accomplished developers for doing exactly that. He was > suitably chagrined :-) > And then I wondered back to my desk and promptly found myself doing the same > thing :-( Logically the boolean domain is a domain over which the natural algebra is boolean algebra, just like there are arithmetic operators over numbers, string operators over strings etc. Intuitively its a different story. Booleans as an (algebraically manipulable) domain is just plain weird. Not sure why... Perhaps because it reifies the structure of our more intimate thinking more than the other domains? Also as you point out, language probably has much to do with it. Dijkstra used to point out A ∧ (B ∨ C) ≡ (A ∧ B) ∨ (A ∧ C) A ∨ (B ∧ C) ≡ (A ∨ B) ∧ (A ∨ C) look normal enough in this form Put then into the way engineers do it and they become A(B + C) = AB + AC A + BC = (A+B)(A+C) and Dijkstra would (gleefully!) point out that the engineers were much more unfamiliar/uneasy with the second than the first. In effect the perfect symmetry of the boolean operators get marred in our intuition when we use poor notation. -- https://mail.python.org/mailman/listinfo/python-list