Booleans (was Re: My .02 on PEP308 + an extra question)

Erik Max Francis max at alcyone.com
Mon Mar 3 04:39:24 EST 2003


Stephen Horne wrote:

> In Borland C++ 5.02 (still my
> everyday compiler, sadly) the following code...
> 
>   #include <iostream>
> 
>   int main (int argc, char *argv [])
>   {
>     cout << true << endl;
>     return 1;
>   }
> 
> ... actually outputs '1' rather than 'true', for instance.

That's what std::boolalpha is for.

> That said, I wish I hadn't mentioned it now. I wanted to counter Eriks
> point because I find Aahz' point about standard spellings compelling
> but Eriks point about full-fledged types much less so. But a
> full-fledged boolean type is in no way harmfull and, given that it is
> now part of Python, there is no point getting into a big debate about
> its relative value.

I thought it was clear from context that when I was referring to a
"full-fledged type" I was referring to a type of Boolean which is
incompatible between integers without explicit conversions.  Such a
thing is what many purists demand when they talk about a distinct
Boolean type, but such a thing is totally impractical as an addition a
preexisting language (without a Boolean type) when backward
compatibility is an important factor, such as for Python.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Custom reconciles us to everything.
\__/ Edmund Burke
    Computer science / http://www.alcyone.com/max/reference/compsci/
 A computer science reference.




More information about the Python-list mailing list