Operator precedence problem
python at mrabarnett.plus.com
Mon Jun 6 15:17:56 EDT 2016
On 2016-06-06 19:44, Random832 wrote:
> On Mon, Jun 6, 2016, at 13:07, Steven D'Aprano wrote:
>> Blimey, you're right. I always thought `and` and `or` had the same
>> precedence. And now that I know better, I have no doubt that I will
>> it again.
> A good way to remember it is that "and" is analogous to multiplication,
> and "or" is analogous to addition. Which is, I assume, _why_ they have
> the same precedence. (why ^ is between | and &, though, is a mystery to
In Pascal, "and" has the same precedence as "*" and "or" has the same
precedence as "+".
More information about the Python-list