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

Greg Ewing greg@cosc.canterbury.ac.nz
Mon, 11 Mar 2002 15:44:21 +1300 (NZDT)


Ka-Ping Yee <ping@lfw.org>:

> But in the new scheme, there is a "blessed" Boolean type.  Does this
> make the other kinds of true and false less legitimate?

No, in the sense that they will still work in boolean
contexts. Yes, in the sense that there will now be a
"real" boolean type, which is perhaps best thought of
as the *only* boolean type, with other values being
converted to booleans in certain contexts.

> If not, then when is it more correct
> to use Boolean values?

When what you're representing is purely a boolean
and nothing else. Just ask yourself "If I were writing
this in Pascal (or some other language with a strong
boolean type) would I declare it as a boolean?"
The answer to that should be pretty clear in most
cases.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+