[MERGE] Document code layout stuff
Harald Meland
harald.meland at usit.uio.no
Thu Sep 6 14:19:54 BST 2007
[Alexander Belchenko]
> What about conditional statement?
>
> if (asdfghjkl != qwertyuio() or
> mnbvcxzasdfgh == poiuytreweqlkjhgfgdfs()):
> action
>
> Is right?
The amount of indentation is correct, AFAICT, but I would have written
the above as
if (asdfghjkl != qwertyuio()
or mnbvcxzasdfgh == poiuytreweqlkjhgfgdfs()):
action
i.e. with the "or" operator at the start of line two rather than at
the end of line one, to make it easier to spot the difference between
the condition's continuation line and the action.
This practice already appears to be quite common in Bazaar code.
PEP 8 doesn't appear to say anything about where to put logic
operators in multi-line conditions like this; maybe it should be
mentioned in HACKING.txt?
--
Harald
More information about the bazaar
mailing list