[Python-ideas] [Python-Dev] bool conversion wart?

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Feb 24 00:36:49 CET 2007


Ron Adam wrote:

> Ok, so what if...  instead of bool being a type, it be a keyword that is 
> just a nicer way to spell 'not not'?

The main benefit of having a bool type is so that its
values display as "True" and "False" rather than whatever
surrogate values you happen to have used to represent
true and false.

The fact that bool() can be used canonicalise a truth
value is secondary -- the same thing could just as well
be achieved by a plain function (as it was before bool
became a type). It's an extremely rare thing to need
to do in any case.

If any change is to be made to bool in 3.0, my preference
would be to keep it but make it a separate type.

 > Are 'and' and 'or' going to be changed in 3.0 to return bool types too?

I very much hope not! Their current behaviour is very
useful, and I would hate to lose it.

--
Greg



More information about the Python-ideas mailing list