[Python-Dev] For review: PEP 285: Adding a bool type

M.-A. Lemburg mal@lemburg.com
Sat, 09 Mar 2002 21:42:32 +0100


Gordon McMillan wrote:
> 
> On 9 Mar 2002 at 18:44, M.-A. Lemburg wrote:
> 
> > Guido van Rossum wrote:
> 
> > > So far you've been carrying this particular
> > > argument all by yourself.
> >
> > I was also the only one that had objections when
> > nested scopes were first proposed by Jeremy on this
> > list... I'm sure others will chime in once you have
> > checked in
> > an implementation.
> 
> It hasn't helped that the argument has contained a
> whole lot of red herrings.

While I don't agree that the arguments I included in the
thread were red herrings, I do admit that this was sports; 
Guido started the game and I played along ;-)

> Personally, I think repr(True) should return 1
> and str(True) should return "True" (in line with
> str being the "friendly" and repr the "techy"
> representations).
> 
> If there were any proposal for and / or to return
> booleans, I'd scream bloody murder, but in my
> own code, I don't forsee much breakage otherwise.

I like the fact that we add extra meta-information to
Py_True and Py_False (type information in this case).

However, we should not pretend the type implements
something which it doesn't. It certainly does not
implement boolean algebra so the name is misleading.

Making it a true boolean type would cause too much
breakage though, so I'd rather have it become an
abstract type, i.e. no special casing except maybe
fixing __repr__ to indicate the different type
to the user...

+1 on making bool an abstract subtype of integers
   and having Py_True and Py_False as only instances

-1 on overriding interfaces other than informational
   ones such as __repr__

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/