[Python-checkins] CVS: python/nondist/peps pep-0285.txt,1.9,1.10

Guido van Rossum gvanrossum@users.sourceforge.net
Fri, 29 Mar 2002 21:16:18 -0800


Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv27556

Modified Files:
	pep-0285.txt 
Log Message:
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).


Index: pep-0285.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0285.txt,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** pep-0285.txt	30 Mar 2002 05:02:42 -0000	1.9
--- pep-0285.txt	30 Mar 2002 05:16:16 -0000	1.10
***************
*** 204,207 ****
--- 204,220 ----
      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