On the eve of posting this to c.l.py, add a response to a common but

nonsensical suggestion (that x == True should hold for all true x).
This commit is contained in:
Guido van Rossum 2002-03-30 05:16:16 +00:00
parent 31b1ea98c7
commit 2fe448c171
1 changed files with 13 additions and 0 deletions

View File

@ -203,6 +203,19 @@ Issues
for functions and types only. But I'm willing to consider the
lowercase alternatives if enough people think it looks better.
It has been suggested that, in order to satisfy user expectations,
for every x that is considered true in a Boolean context, the
expression x == True should be true, and likewise if x is
considered false, x == False should be true. This is of course
impossible; it would mean that e.g. 6 == True and 7 == True, from
which one could infer 6 == 7. Similarly, [] == False == None
would be true, and one could infer [] == None, which is not the
case. I'm not sure where this suggestion came from; it was made
several times during the first review period. For truth testing
of a value, one should use "if", e.g. "if x: print 'Yes'", not
comparison to a truth value; "if x == True: print 'Yes'" is not
only wrong, it is also strangely redundant.
Implementation