PEP 285: Adding a bool type

Martin v. Loewis martin at v.loewis.de
Sat Mar 30 06:46:03 EST 2002


Paul Rubin <phr-n2002a at nightsong.com> writes:

> I don't see much need for it.  There's no need to turn Python into Java.
> Python, C, and Lisp have all done fine without bools.  

C99 has stdbool.h, though.

> What kinds of programming tasks in Python are bools supposed to make
> easier?

RPC implementations (see the rationale in the PEP), XPath processors.

> >     Some external libraries (like databases and RPC packages) need to
> >     be able to distinguish between Boolean and integral values, and
> >     while it's usually possible to craft a solution, it would be
> >     easier if the language offered a standard Boolean type.
> 
> Again, most of those libraries have C interfaces

Actually, no. Most of those libraries are pure-Python. Those that do
use C interfaces need to expose the bool types of the C interface.

> and (pre-C99) C didn't have bools.

Many C programs (in particular pre-C99) have bools. Not just one, but
hundreds of them. C99 introduces an additional one, which it calls the
"standard" boolean type.

Regards,
Martin



More information about the Python-list mailing list