On Thu, 12 May 2011 23:46:12 -0700, rusi wrote: > Mathematics has existed for millenia. Hindu-arabic numerals (base-10 > numbers) have been known for about one millennium > The boolean domain is only a 100 years old. Unsurprisingly it is not > quite 'first-class' yet: See > http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1070.html > [Lifted from http://c2.com/cgi/wiki?EqualVsTrueFalse ]
Th money-quote as regards using arbitrary objects in truth tests: [quote] All this changed with the introduction of the two-element boolean domain {true, false} which provides the vocabulary needed to assign values to boolean expressions: 3<4 is a way for writing true, 3>4 is a way for writing false, whereas the value of x>0 depends on the value of x ... [end quote] In Python, [1, 2, 3] is another way of writing true, and [] is another way of writing false. Similarly with any other arbitrary objects. The only things that bools True and False are good for are: * giving functions a canonical way of spelling true/false when they want to emit a Boolean value; * giving documentation writers a canonical way of spelling true/false when they want to discuss passing a Boolean value. Other than those conveniences, there's nothing you can do with True and False in Python that you can't do with any other set of objects. -- Steven -- http://mail.python.org/mailman/listinfo/python-list