if, continuation and indentation

Harald Luessen harald.luessen at gmx.de
Thu May 27 11:34:46 EDT 2010


On Thu, 27 May 2010 HH wrote:

>I have a question about best practices when it comes to line wrapping/
>continuation and indentation, specifically in the case of an if
>statement.
>
>    if (width == 0 and
>        height == 0 and
>        color == 'red' and
>        emphasis == 'strong' or
>        highlight > 100):
>        raise ValueError("sorry, you lose")

My solution would probably look like this:

if (       width == 0
       and height == 0
       and color == 'red'
       and emphasis == 'strong'
    or highlight > 100
   ):
    raise ValueError("sorry, you lose")

Harald




More information about the Python-list mailing list