Clarify preferred way to break at a binary operator.

This commit is contained in:
Guido van Rossum 2008-06-06 18:48:49 +00:00
parent 617bc3a168
commit b4c0b18633
1 changed files with 4 additions and 2 deletions

View File

@ -87,7 +87,8 @@ Code lay-out
continuation inside parentheses, brackets and braces. If necessary, you continuation inside parentheses, brackets and braces. If necessary, you
can add an extra pair of parentheses around an expression, but sometimes can add an extra pair of parentheses around an expression, but sometimes
using a backslash looks better. Make sure to indent the continued line using a backslash looks better. Make sure to indent the continued line
appropriately. Some examples: appropriately. The preferred place to break around a binary operator is
*after* the operator, not before it. Some examples:
class Rectangle(Blob): class Rectangle(Blob):
@ -99,7 +100,8 @@ Code lay-out
raise ValueError("sorry, you lose") raise ValueError("sorry, you lose")
if width == 0 and height == 0 and (color == 'red' or if width == 0 and height == 0 and (color == 'red' or
emphasis is None): emphasis is None):
raise ValueError("I don't think so") raise ValueError("I don't think so -- values are %s, %s" %
(width, height))
Blob.__init__(self, width, height, Blob.__init__(self, width, height,
color, emphasis, highlight) color, emphasis, highlight)