Search code examples
python-3.xpep8flake8

Break python assignment into multiple lines


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.


Solution

  • Another way to use parentheses:

    long_name, longer_name, even_longer_name = (
        list_to_break_into_long_names)