PEP 285: Adding a bool type

Pearu Peterson pearu at cens.ioc.ee
Sat Mar 30 08:40:17 EST 2002


> ----- Original Message ----- 
> From: "Guido van Rossum" <guido at python.org>
> 
> >     Dear reviewers:
> > 
> >     I'm particularly interested in hearing your opinion about the
> >     following three issues:
> > 
> >     1) Should this PEP be accepted at all.

It seems that this is already decided as Guido is the author and also the
only one who accepts PEPs.

> >     The standard bool type can also serve as a way to force a value to
> >     be interpreted as a Boolean, which can be used to normalize
> >     Boolean values.  Writing bool(x) is much clearer than "not not x"
> >     and much more concise than
> >         if x:
> >             return 1
> >         else:
> >             return 0

This one does not convince me at all as one could always define

  bool = lambda x: not not x

and I would never write such a verbose code fragment as above just to
return whether x is false or true. However, using constructs like

  if x:
     ...

  while x:
     ...

for x being a sequence or dictionary can be very useful and efficient.

In future (Python 2.>=3, >3), are these constructs valid or must they
be replaced with  

  while bool(x):
    ...

? :(


Ka-Ping Yee has raised related conserns in

  http://mail.python.org/pipermail/python-dev/2002-March/020893.html

that never got a proper answer from Guido nor others.

So, I am (-1)*0 on this PEP. 

-1 --- I have succesfully programmed in Python without needing the bool
function and I share Ka-Ping's concerns about Python future. To me the
only reasonable point in rationale seems to be that "other languages have
or will have boolean". That also sounds quite weak to me --- other
languages have many useful concepts that would be more worth for 
introducing to Python than this boolean concept.

0  --- this PEP will be hardly rejected, it seems to me.

Regards,
	Pearu




More information about the Python-list mailing list