Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: MRAB Newsgroups: comp.lang.python Subject: Re: Operator precedence problem Date: Mon, 6 Jun 2016 20:17:56 +0100 Lines: 15 Message-ID: References: <816c651a-d0ae-4e23-a5b2-72a8f7398468@googlegroups.com> <3ff71354-461a-4635-8d1a-c879243e39a8@googlegroups.com> <2a577a90-3a39-4d8f-90fa-4a00fd4f06a3@googlegroups.com> <1465221421.1069788.629246361.60094337@webmail.messagingengine.com> <5755adcc$0$1605$c3e8da3$5496439d@news.astraweb.com> <1465238652.1130239.629575665.537F855D@webmail.messagingengine.com> <7935293c-177b-f720-bff4-65d5b7d6dd16@mrabarnett.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de SYR4ma2LVmB+Qp0UsI5AygNwWJB+uIGIHgBfK0Q8n8SA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'precedence': 0.09; '"*"': 0.16; '"and"': 0.16; '"or"': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'precedence.': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'subject:problem': 0.22; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'header:User- Agent:1': 0.26; 'right.': 0.27; 'received:84': 0.32; 'though,': 0.32; "d'aprano": 0.33; 'doubt': 0.33; 'steven': 0.33; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'thought': 0.37; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'forget': 0.60; 'between': 0.65; '(why': 0.84; 'mystery': 0.95 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=bsGxfxui c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=IkcTkHD0fZMA:10 a=OXybA_ZAQnf8a4vJWF4A:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett@:2500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 In-Reply-To: <1465238652.1130239.629575665.537F855D@webmail.messagingengine.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <7935293c-177b-f720-bff4-65d5b7d6dd16@mrabarnett.plus.com> X-Mailman-Original-References: <816c651a-d0ae-4e23-a5b2-72a8f7398468@googlegroups.com> <3ff71354-461a-4635-8d1a-c879243e39a8@googlegroups.com> <2a577a90-3a39-4d8f-90fa-4a00fd4f06a3@googlegroups.com> <1465221421.1069788.629246361.60094337@webmail.messagingengine.com> <5755adcc$0$1605$c3e8da3$5496439d@news.astraweb.com> <1465238652.1130239.629575665.537F855D@webmail.messagingengine.com> Xref: csiph.com comp.lang.python:109591 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 >> forget >> 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 > me.) > In Pascal, "and" has the same precedence as "*" and "or" has the same precedence as "+".