On Fri, 17 Mar 2000, Barry A. Warsaw wrote:
Almost a year ago, I mused about a boolean type in c.l.py, and came up with this prototype in Python.
Cool prototype! However, I think I have a problem with the proposed semantics:
def __cmp__(self, other): if (self.__flag and other) or (not self.__flag and not other): return 0 else: return 1
This means: true == 1 true == 2 But 1 != 2 I have some difficulty with == not being an equivalence relation...
I think it makes sense to augment Python's current truth rules with a built-in boolean type and True and False values.
Right on! Except for the built-in...why not have it like exceptions.py, Python code necessary for the interpreter? Languages which compile themselves are not unheard of <wink>
But unless it's tied in more deeply (e.g. comparisons return one of these instead of integers -- and what are the implications of that?)
Breaking loads of horrible code. Unacceptable for the 1.x series, but perfectly fine in Py3K -- Moshe Zadka <mzadka@geocities.com>. http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com