From 78c759d6365d7ce0e0cb093f8d268274c7602965 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 24 May 2002 19:46:20 +0000 Subject: [PATCH] Two tiny clarifications. --- pep-0008.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pep-0008.txt b/pep-0008.txt index 4cf346b0a..655cb9b6c 100644 --- a/pep-0008.txt +++ b/pep-0008.txt @@ -506,7 +506,8 @@ Programming Recommendations 'is' or 'is not'. Also, beware of writing "if x" when you really mean "if x is not None" -- e.g. when testing whether a variable or argument that defaults to None was set to some other - value. + value. The other value might be a value that's false in a + Boolean context! - Class-based exceptions are always preferred over string-based exceptions. Modules or packages should define their own @@ -554,7 +555,10 @@ Programming Recommendations reindent.py) will trim them. - Don't compare boolean values to True or False using == (bool - types are new in Python 2.3). + types are new in Python 2.3): + + No: if greeting == True: print "Hello world" + Yes: if greeting: print "Hello world" References