PEP 285: Adding a bool type

Ralph Corderoy ralph at inputplus.demon.co.uk
Sat Mar 30 04:23:28 EST 2002


Hi Guido,

>     I'm particularly interested in hearing your opinion about the
>     following three issues:
> 
>     1) Should this PEP be accepted at all.

I've not coded heavily in a language with a boolean type since Fortran.
I'm willing to give it a go though.

>     3) Should the constants be called 'True' and 'False'
>        (corresponding to None) or 'true' and 'false' (as in C++, Java
>        and C99).

I'd much prefer true and false, but then I'd like none too.  Given the
DarkAlley we've already started down I guess True and False would be
better as more consistent within the language.  Any chance of built-in
constants being available as lower-case too?  Or just true and false
for the moment?

>     4) Should we strive to eliminate non-Boolean operations on bools
>        in the future, through suitable warnings, so that e.g. True+1
>        would eventually (e.g. in Python 3000 be illegal).

Definitely not, that would just lead to more long-winded source for
little gain.

>        Personally, I think we shouldn't; 28+isleap(y) seems totally
>        reasonable to me.

Absolutely.

>     5) Should operator.truth(x) return an int or a bool.  Tim Peters
>        believes it should return an int because it's been documented
>        as such.

Unlike Tim to produce such a poor reason.  Has he been paraphrased a
little too much?

>        I think it should return a bool; most other standard
>        predicates (e.g. issubtype()) have also been documented as
>        returning 0 or 1, and it's obvious that we want to change
>        those to return a bool.

Right.

Cheers,


Ralph.




More information about the Python-list mailing list