From bbc55dbeb2b1f7402ef02556b576c437bc7b2eec Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Wed, 9 Feb 2011 06:50:14 +0000 Subject: [PATCH] Add note about how Control-L gets displayed. Fix whitespace. --- pep-0008.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pep-0008.txt b/pep-0008.txt index b9a5a6adc..bf6df05cb 100644 --- a/pep-0008.txt +++ b/pep-0008.txt @@ -86,9 +86,9 @@ Code lay-out The preferred way of wrapping long lines is by using Python's implied line continuation inside parentheses, brackets and braces. Long lines can be broken over multiple lines by wrapping expressions in parentheses. These - should be used in preference to using a backslash for line continuation. + should be used in preference to using a backslash for line continuation. Make sure to indent the continued line appropriately. The preferred place - to break around a binary operator is *after* the operator, not before it. + to break around a binary operator is *after* the operator, not before it. Some examples: class Rectangle(Blob): @@ -120,7 +120,9 @@ Code lay-out Python accepts the control-L (i.e. ^L) form feed character as whitespace; Many tools treat these characters as page separators, so you may use them - to separate pages of related sections of your file. + to separate pages of related sections of your file. Note, some editors + and web-based code viewers may not recognize control-L as a form feed + and will show another glyph in its place. Encodings (PEP 263) @@ -697,14 +699,14 @@ Programming Recommendations try: import platform_specific_module except ImportError: - platform_specific_module = None + platform_specific_module = None A bare 'except:' clause will catch SystemExit and KeyboardInterrupt exceptions, making it harder to interrupt a program with Control-C, and can disguise other problems. If you want to catch all exceptions that signal program errors, use 'except Exception:'. - A good rule of thumb is to limit use of bare 'except' clauses to two + A good rule of thumb is to limit use of bare 'except' clauses to two cases: 1) If the exception handler will be printing out or logging