Wrapping Lines |
Beautiful Code Ka-Ping Yee |
Keep all lines under 75 characters or so.
Two main styles for wrapping lines with brackets:
1. Break immediately after an opening bracket. Indent four spaces.
month_names = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
2. Break in the middle of the list. Align with the appropriate opening bracket.
month_names = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
This also applies to function arguments (probably the most common case).
When there are no brackets, use a backslash at the end of the line. Indent wrapped lines to a meaningful depth.
print 'The number of digits shall be at most FIVE, sillyhead.', \ len(input), 'is RIGHT OUT.'