Add note about how Control-L gets displayed. Fix whitespace.

This commit is contained in:
Raymond Hettinger 2011-02-09 06:50:14 +00:00
parent 3c6691491d
commit bbc55dbeb2
1 changed files with 7 additions and 5 deletions

View File

@ -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