Reputation: 153
What would be the cleanest way to break this into multiple lines following PEP8's guidelines?
long_name, longer_name, even_longer_name = list_to_break_into_long_names
I could think of
long_name, longer_name, even_longer_name = \
list_to_break_into_long_names
but a backslash raises C092 prefer implied line continuation inside parentheses, brackets, and braces as opposed to a backslash
. I'm unable to think of a clean way to do this.
Upvotes: 0
Views: 516
Reputation: 3453
Another way to use parentheses:
long_name, longer_name, even_longer_name = (
list_to_break_into_long_names)
Upvotes: 1
Reputation: 1330
How about using parentheses
(
long_name,
longer_name,
even_longer_name,
) = list_to_break_into_long_names
Also you might consider using a tool like python-black to just make formatting automatic and just accept the way it does it. The disadvantage is that it may not quite be the way you would think best. The advantage is that it does it reasonably well and you can spend less time thinking about cleaning up your code formatting.
Upvotes: 3