diff --git a/pep-0008.txt b/pep-0008.txt index 2eb3c2f82..a2d23ef94 100644 --- a/pep-0008.txt +++ b/pep-0008.txt @@ -238,6 +238,17 @@ Whitespace in Expressions and Statements def complex(real, imag=0.0): return magic(r=real, i=imag) + - Compound statements (multiple statements on the same line) are + generally discouraged. + + No: if foo == 'blah': do_blah_thing() + Yes: if foo == 'blah': + do_blah_thing() + + No: do_one(); do_two(); do_three() + Yes: do_one() + do_two() + do_three() Comments @@ -580,8 +591,8 @@ Programming Recommendations - Don't compare boolean values to True or False using == (bool types are new in Python 2.3): - No: if greeting == True: print "Hello world" - Yes: if greeting: print "Hello world" + No: if greeting == True: + Yes: if greeting: References