Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Operator precedence problem Date: Tue, 7 Jun 2016 01:57:34 +1000 Lines: 23 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> <87inxmmm67.fsf@elektro.pacujo.net> <87a8iymjel.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de P+jPHXNy/KHjUTi5xmplVgH2RWm5u4BTejrmJPQilagA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'expressions': 0.07; 'interpreted': 0.07; 'cc:addr:python-list': 0.09; 'brackets': 0.09; 'received:74.125.82.44': 0.15; 'interpreter': 0.15; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'parentheses:': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'suppose.': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; "aren't": 0.22; 'subject:problem': 0.22; 'am,': 0.23; 'bit': 0.23; 'header:In- Reply-To:1': 0.24; 'figure': 0.27; 'message-id:@mail.gmail.com': 0.27; 'sensible': 0.29; 'comments': 0.30; 'code': 0.30; 'case,': 0.34; 'tue,': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'something': 0.35; 'received:74.125.82': 0.35; 'should': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'future': 0.60; 'your': 0.60; 'is.': 0.63; 'readers': 0.66; 'here': 0.66; '"active': 0.84; 'chrisa': 0.84; 'unclear': 0.84; 'to:none': 0.91; 'beneficial': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=qEpKqhAwfh9smAN93Y/mcplHuZ/dzn5WOY9VhggiWng=; b=p5Ioyt3VW8YP4EACmpPkbL/5VR6zZWkt4N7GETy3/UIgAc6iKNz7aMJiXoW1XaspC5 kg52S36/GmwbLRjWU0gQm0Es3QicnXjIFSUr1Z2lPOPH4wQgcht/Qblmly044lHoasp1 6kuV0XDNf0dZwNtzUIONCFi5w8xrl+rtgVRN/fTJXrfbbgr5lvif7D0YL7njbV1WXkUo J/UCoiut9Vct/gHJuavbnB85uSwVR8XmMPV/f58umBqNRGSLsqDjEy8XmR5y44sw3yTi Ck8Gq9+PVX0qbWbV/vcXJo7L++rE6esWBDd7twk01vnUuRztaQl0PhrPI/Ccl7CfbWaE teTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=qEpKqhAwfh9smAN93Y/mcplHuZ/dzn5WOY9VhggiWng=; b=fT0MX+UwwxdPEEGOwFTd3erRNNyLhRh9OHeg+9HY8qlwBZ8A7HwkxCzRGY/H7rd6eF GZpiZcrBa3YeF9TQopDfDDjdYl+ZSXNBQA3qvbKvAeTNZqrSCazdHr8PCsQYb0haIqUx 5vB3Vcm4YBa95gwPBlsYLeXLizIMKmISeEFjlx9ZmwFYfc7EeX7/rSB76FIdIufvEmBC B1/C0rigeoQVWLbutgOtz4D2F68J5m/lIB6GPxkskNAn1CiurrWbIiHvFvXnTJiF76qM v9RphDsq+mhfqwQlvUn7EjhhZAAsUirbbGy2qKffYr0FMxX6bQq5NjxqvimVWsoxqggU mONA== X-Gm-Message-State: ALyK8tL+eUrN6Jlh82Wuz0YesmrVND/0YmCcjoSb07LzGhS56Cz1/K0XxH04dkuN8LL9RxrEMwJ2H3fFfAhOuA== X-Received: by 10.194.80.42 with SMTP id o10mr16019951wjx.117.1465228654829; Mon, 06 Jun 2016 08:57:34 -0700 (PDT) In-Reply-To: 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: 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> <87inxmmm67.fsf@elektro.pacujo.net> <87a8iymjel.fsf@elektro.pacujo.net> Xref: csiph.com comp.lang.python:109575 On Tue, Jun 7, 2016 at 1:27 AM, Jon Ribbens wrote: >>> You should put brackets around expressions when it's at all unclear >>> what the meaning is. You could think of them a bit like "active >>> comments" I suppose. >> >> Your code should keep noise to the minimum. > > Sensible and beneficial comments aren't "noise". In that case, please never insult the intelligence of your future readers by including any of these parentheses: x = 1 + (2 * 3) value = 77 if (x % 2) else (70*7) And if your readers have to figure out what 3**3**3 is interpreted as, there should be an interactive interpreter around. Or here - try something cute: >>> 2**2**-1 ChrisA