[Python-Dev] RE: Re: PEP 285: Adding a bool type
Guido van Rossum
guido@python.org
Wed, 03 Apr 2002 13:58:38 -0500
> Having canonical True and False values would lead newcomers
> to compare to them. This would work, for example:
>
> DONE = y and (x > y)
> ...
> if DONE is False:
> ...
>
> On the other hand, this wouldn't (unless y is a boolean):
>
> DONE = (x > y) and y
> ...
> if DONE is False:
> ...
>
> Of course, it works either way if you replace "DONE is False"
> with "not DONE".
Tutorial should point this out. It's poor coding style even in
languages that do have strict Booleans, so I think it's a good idea to
nip this one in the bud.
> Or if you replace "y" with "bool(y)".
What a waste to write "if bool(y) == True" instead of "if y" ... :-(
--Guido van Rossum (home page: http://www.python.org/~guido/)