Re: [Tutor] and-or precedence

2005-10-10 Thread ZIYAD A. M. AL-BATLY
On Mon, 2005-10-10 at 17:58 +0530, Krishna wrote: > >>> 1 or 2 and 3 > 1 > > Why does the above expression return 1? As per my understanding of > boolean operations, this is what should have happaned: > > 1 or 2 => 1 and then > 1 and 3 => 3 > > The library reference also suggests that 'or' has h

Re: [Tutor] and-or precedence

2005-10-10 Thread paul brian
has a higher priority than (as shown on the page you referenced -its "ascending priority"). Perhaps that could be clearer. I find that brackets always make life easier in these cases (a rare statement in the Python world :-), and on a personal note I would always always comment heavily boolean o

[Tutor] and-or precedence

2005-10-10 Thread Krishna
>>> 1 or 2 and 3 1 Why does the above expression return 1? As per my understanding of boolean operations, this is what should have happaned: 1 or 2 => 1 and then 1 and 3 => 3 The library reference also suggests that 'or' has higher priority than 'and'. http://docs.python.org/lib/boolean.html Th