how to format long if conditions

Hans Mulder hansmu at
Sat Aug 27 12:51:16 CEST 2011

On 27/08/11 11:05:25, Steven D'Aprano wrote:
> Hans Mulder wrote:
> [...]
>> It may look ugly, but it's very clear where the condition part ends
>> and the 'then' part begins.
> Immediately after the colon, surely?

On the next line, actually :-)

The point is, that this layout makes it very clear that the colon
isn't in its usual position (at the end of the line that starts
with 'if') and it is clearly visible.

With the layout Arnaud originally propose, finding the colon takes
longer.  (Arnaud has since posted a better approach, in which the
colon is back in its usual position.)

-- HansM

More information about the Python-list mailing list