On May 27, 11:37 am, Alain Ketterlin <al...@dpt-info.u-strasbg.fr> wrote: > HH <henri...@gmail.com> writes: > > if (width == 0 and > > height == 0 and > > color == 'red' and > > emphasis == 'strong' or > > highlight > 100): > > raise ValueError("sorry, you lose") > > I prefer to see the "and" at the beginning of continuation lines, and > usually group related items. I never mix operators without putting > explicit parentheses. Something like: > > if ( width == 0 and height == 0 > and color == 'red' > and ( emphasis == 'strong' or highlight > 100 ) ): > raise ValueError("sorry, you lose")
Thanks for all suggestions! I like this solution a lot. I agree with your statement about mixed operators and explicit parentheses -- expecially since the eye/brain parser often does it wrong, and I believe you demonstrated that above... In [29]: print(False and (False or True)) False In [30]: print(False and False or True) True > If you use a backslashes at the end of line, emacs will double-indent > the following lines, but I think you said you prefer paretheses... Yes, I much prefer the parentheses -- partly because PEP-8 suggests it but mostly because the escapes get lost too easily. HH -- http://mail.python.org/mailman/listinfo/python-list