I want to wrap the following lines to be PEP compliant and I believe both of them are valid. I have heard some people won't recommend backslashes at all, Which one is less ugly for you?
bake_occ_static_pass.compute_behavior = (
bake_occ_static_pass.original_compute_behavior)
bake_areas_animated_pass.compute_behavior = \
bake_areas_animated_pass.original_compute_behavior
Thanks in advance.
1 is preferred. Quoting the word of Gods, aka PEP8:
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.
Backslashes may still be appropriate at times. For example, long, multiple
with
-statements cannot use implicit continuation, so backslashes are acceptable.
Even for import
, the PEP 328 added the parenthesized form, as
from Tkinter import (Tk, Frame, Button, Entry, Canvas, Text,
LEFT, DISABLED, NORMAL, RIDGE, END)
is prettier than
from Tkinter import Tk, Frame, Button, Entry, Canvas, Text, \
LEFT, DISABLED, NORMAL, RIDGE, END