Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109581

Re: Operator precedence problem

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Grant Edwards <grant.b.edwards@gmail.com>
Newsgroups comp.lang.python
Subject Re: Operator precedence problem
Date Mon, 6 Jun 2016 16:51:52 +0000 (UTC)
Lines 32
Message-ID <mailman.43.1465231923.2306.python-list@python.org> (permalink)
References <816c651a-d0ae-4e23-a5b2-72a8f7398468@googlegroups.com> <nj0kol$ps$1@ger.gmane.org> <mailman.5.1465112166.2306.python-list@python.org> <3ff71354-461a-4635-8d1a-c879243e39a8@googlegroups.com> <CAMQ2MsFfxF0wSL_y9tSFCoJ1BJ+GVqi2qJLTBzs7+BbGRjW3Bw@mail.gmail.com> <mailman.9.1465142763.2306.python-list@python.org> <2a577a90-3a39-4d8f-90fa-4a00fd4f06a3@googlegroups.com> <1465221421.1069788.629246361.60094337@webmail.messagingengine.com> <mailman.37.1465221424.2306.python-list@python.org> <87inxmmm67.fsf@elektro.pacujo.net> <slrnnlb459.6f8.jon+usenet@sable.unequivocal.co.uk> <87a8iymjel.fsf@elektro.pacujo.net> <slrnnlb5jj.6f8.jon+usenet@sable.unequivocal.co.uk> <CAPTjJmq7vkfZmNndbJn-azX+c8KwjW3uZCzprYdcYU+aM8Ec9A@mail.gmail.com> <nj49n8$orr$1@ger.gmane.org>
X-Trace news.uni-berlin.de FPE5Nz4oJEzeRZLiYDm/sgr3tS7epM2VgTCySOiHnK7Q==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'expressions': 0.07; 'brackets': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:qwest.net': 0.09; '2016': 0.16; 'nose': 0.16; 'parentheses:': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'suppose.': 0.16; 'wrote:': 0.16; '>>>': 0.20; "aren't": 0.22; 'subject:problem': 0.22; 'am,': 0.23; 'code,': 0.23; 'bit': 0.23; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'chris': 0.26; 'said,': 0.27; 'ronald': 0.29; 'sensible': 0.29; "i'm": 0.30; 'comments': 0.30; 'code': 0.30; 'problem': 0.33; 'case,': 0.34; 'tue,': 0.34; 'could': 0.35; 'clear': 0.35; 'but': 0.36; 'should': 0.36; 'cases': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'sure': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'future': 0.60; 'your': 0.60; 'is.': 0.63; 'intent': 0.66; 'readers': 0.66; "they're": 0.66; '"active': 0.84; 'unclear': 0.84; 'beneficial': 0.91; 'edwards': 0.91
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host 67-130-15-94.dia.static.qwest.net
User-Agent slrn/1.0.2 (Linux)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <nj49n8$orr$1@ger.gmane.org>
X-Mailman-Original-References <816c651a-d0ae-4e23-a5b2-72a8f7398468@googlegroups.com> <nj0kol$ps$1@ger.gmane.org> <mailman.5.1465112166.2306.python-list@python.org> <3ff71354-461a-4635-8d1a-c879243e39a8@googlegroups.com> <CAMQ2MsFfxF0wSL_y9tSFCoJ1BJ+GVqi2qJLTBzs7+BbGRjW3Bw@mail.gmail.com> <mailman.9.1465142763.2306.python-list@python.org> <2a577a90-3a39-4d8f-90fa-4a00fd4f06a3@googlegroups.com> <1465221421.1069788.629246361.60094337@webmail.messagingengine.com> <mailman.37.1465221424.2306.python-list@python.org> <87inxmmm67.fsf@elektro.pacujo.net> <slrnnlb459.6f8.jon+usenet@sable.unequivocal.co.uk> <87a8iymjel.fsf@elektro.pacujo.net> <slrnnlb5jj.6f8.jon+usenet@sable.unequivocal.co.uk> <CAPTjJmq7vkfZmNndbJn-azX+c8KwjW3uZCzprYdcYU+aM8Ec9A@mail.gmail.com>
Xref csiph.com comp.lang.python:109581

Show key headers only | View raw


On 2016-06-06, Chris Angelico <rosuav@gmail.com> wrote:
> On Tue, Jun 7, 2016 at 1:27 AM, Jon Ribbens
><jon+usenet@unequivocal.co.uk> 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)

Just for the record, I don't have any problem at all with any of those
parens.  I don't think they're at all insulting, they don't slow down
comprehension, and they make clear the intent of the writer.  I'm not
sure I would include all of them if _I_ were writing the code, but in
this specific example, I think they're fine.

That said, I have seen lots of cases where fully parenthising an
expression would harm readability...

-- 
Grant Edwards               grant.b.edwards        Yow! My nose feels like a
                                  at               bad Ronald Reagan movie ...
                              gmail.com            

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Operator precedence problem ICT Ezy <ictezy@gmail.com> - 2016-06-04 23:53 -0700
  Re: Operator precedence problem Peter Otten <__peter__@web.de> - 2016-06-05 09:35 +0200
    Re: Operator precedence problem ICT Ezy <ictezy@gmail.com> - 2016-06-05 08:05 -0700
      Re: Operator precedence problem Uri Even-Chen <uri@speedy.net> - 2016-06-05 19:05 +0300
        Re: Operator precedence problem ICT Ezy <ictezy@gmail.com> - 2016-06-05 20:24 -0700
        Re: Operator precedence problem Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-05 22:46 -0700
          Re: Operator precedence problem Random832 <random832@fastmail.com> - 2016-06-06 09:57 -0400
            Re: Operator precedence problem Marko Rauhamaa <marko@pacujo.net> - 2016-06-06 17:22 +0300
              Re: Operator precedence problem Random832 <random832@fastmail.com> - 2016-06-06 10:35 -0400
                Re: Operator precedence problem Marko Rauhamaa <marko@pacujo.net> - 2016-06-06 17:55 +0300
              Re: Operator precedence problem Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2016-06-06 15:03 +0000
                Re: Operator precedence problem Marko Rauhamaa <marko@pacujo.net> - 2016-06-06 18:22 +0300
                Re: Operator precedence problem Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2016-06-06 15:27 +0000
                Re: Operator precedence problem Chris Angelico <rosuav@gmail.com> - 2016-06-07 01:57 +1000
                Re: Operator precedence problem Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2016-06-06 16:05 +0000
                Re: Operator precedence problem Chris Angelico <rosuav@gmail.com> - 2016-06-07 02:21 +1000
                Re: Operator precedence problem Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2016-06-06 17:02 +0000
                Re: Operator precedence problem Grant Edwards <grant.b.edwards@gmail.com> - 2016-06-06 16:51 +0000
              Re: Operator precedence problem Peter Otten <__peter__@web.de> - 2016-06-06 18:38 +0200
            Re: Operator precedence problem Steven D'Aprano <steve@pearwood.info> - 2016-06-07 03:07 +1000
              Re: Operator precedence problem Random832 <random832@fastmail.com> - 2016-06-06 14:44 -0400
                Re: Operator precedence problem Marko Rauhamaa <marko@pacujo.net> - 2016-06-06 21:49 +0300
              Re: Operator precedence problem MRAB <python@mrabarnett.plus.com> - 2016-06-06 20:17 +0100
                Re: Operator precedence problem Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-07 11:27 +1200
            Re: Operator precedence problem Rustom Mody <rustompmody@gmail.com> - 2016-06-06 10:14 -0700
              Re: Operator precedence problem Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-06 21:09 +0100
      Re: Operator precedence problem Michael Torrie <torriem@gmail.com> - 2016-06-05 17:47 -0600
        Re: Operator precedence problem ICT Ezy <ictezy@gmail.com> - 2016-06-05 20:23 -0700
  Re: Operator precedence problem Chris Angelico <rosuav@gmail.com> - 2016-06-06 02:24 +1000
    Re: Operator precedence problem Peter Pearson <pkpearson@nowhere.invalid> - 2016-06-06 16:58 +0000
      Re: Operator precedence problem Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-07 11:21 +1200
  Re: Operator precedence problem Random832 <random832@fastmail.com> - 2016-06-05 13:19 -0400
    Re: Operator precedence problem ICT Ezy <ictezy@gmail.com> - 2016-06-05 20:23 -0700
  Re: Operator precedence problem Gary Herron <gherron@digipen.edu> - 2016-06-05 00:04 -0700

csiph-web