Continuing indentation

Marko Rauhamaa marko at pacujo.net
Wed Mar 2 15:50:02 EST 2016


Skip Montanaro <skip.montanaro at gmail.com>:

> Running flake8 over some code which has if statements with multiple
> conditions like this:
>
>     if (some_condition and
>         some_other_condition and
>         some_final_condition):
>         play_bingo()
> [...]
>
> is there a better way to break lines I'm missing which will make
> flake8 happy?

This is the idiomatic way:

    if some_condition and \
       some_other_condition and \
       some_final_condition:
        play_bingo()


Marko



More information about the Python-list mailing list