Guido van Rossum wrote:
def __repr__(self): if self: return "True" else: return "False"
__str__ = __repr__
I don't like this: it will break too much code since there are already two singletons Py_True and Py_False available in Python and these return 1 / 0 resp.
But this is the whole point of introducing a new type rather than simply defining True as 1 and False as 0!
That's not how I read it: making bool a type would allow type checks to be done and this is a *much* more important feature to have than some different str(obj) output. There are many situations when doing RPC or interfacing with other systems such as databases where a type check for booleans is needed. Currently, this can be done by simply using the already existing Py_True and Py_False which are exposed at Python level through (1==1) and (1==0) and we should not break this scheme. '%s' % True must continue to deliver '0' otherwise you'll end up breaking interfaces which rely on this (such as database modules). There's also another issue here: "True" and "False" are English words, "0" and "1" are language neutral. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/