On Tue, May 7, 2013 at 6:11 AM, Terry Jan Reedy <tjre...@udel.edu> wrote:
> On 5/6/2013 11:31 AM, Roy Smith wrote:
>>
>> In article <mailman.1361.1367847484.3114.python-l...@python.org>,
>> Chris Angelico  <ros...@gmail.com> wrote:
>>> If I ever have even the slightest doubt, I just go ahead and type
>>> "<language> operator precedence" into a web search and check it :)
>>
>>
>> Well, that solves the problem once, and it solves it for me.  I figure
>> if I'm not 100% sure, then maybe other people aren't 100% sure either,
>> and my adding the extra parens helps them too.
>
>
> If you keep the Python docs handy, on or off line, the Language manual
> Expressions chapter ends with this single page (but better formatted as a
> table than here). But I sometimes add parens for quickness or readability.
>
> or Boolean OR
> and Boolean AND

Actually, this is one exception. I tend to parenthesize any case where
there's a complex set of conditions and mixed AND and OR operations.
Part of the reason for this is that any expression that can be
affected by the precedence of and and or will most likely be fairly
long and/or complex anyway, so a few extra parens won't hurt.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to