PEP 285: Adding a bool type

Steve Holden sholden at holdenweb.com
Mon Apr 1 07:56:06 EST 2002


"Pearu Peterson" <pearu at cens.ioc.ee> wrote in message
news:Pine.LNX.4.21.0203301456390.16587-100000 at cens.ioc.ee...
>
> > ----- 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.
>
That's not fair. Guido's record on accepting language change may not be
perfect, but the fact that he's prepared to submit a PEP rather than
institute a unilateral change is to be praised. Remember the division
brouhaha? As a result of user comments there were significant changes to the
proposed policy.

> > >     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):
>     ...
>
> ? :(
>
If you seriously think that a proposal from the language's principal
designer would cause such massive code breakage, not to mention
contradicting almost every published Python book, then you aren't reading
the same newsgroup, or using the same language, as I am!

>
> 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.
>
Possibly so, but is seems absolutely clear from the posted proposal that the
answers to Ka-Ping's questions are "No", "No" and "No" respectively.

> 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.
>
The most reasonable point in the rationale to *me* was the "experience from
teaching Python...".

> 0  --- this PEP will be hardly rejected, it seems to me.
>
Again, I think you're being unfair to Guido. If the PEP is accepted ist will
be because you are in a minority who think it will not result in improvement
to the language (or at least will not degrade it at all).

Did it catch you on a bad day?

regards
 Steve







More information about the Python-list mailing list