Continuing indentation

Ethan Furman ethan at stoneleaf.us
Wed Mar 2 17:01:04 EST 2016


On 03/02/2016 12:50 PM, Marko Rauhamaa wrote:
> Skip Montanaro queried:
>
>> 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()

No, it isn't.  Using '\' for line continuation is strongly discouraged.

--
~Ethan~



More information about the Python-list mailing list