Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109564
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Random832 <random832@fastmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Operator precedence problem |
| Date | Mon, 06 Jun 2016 09:57:01 -0400 |
| Lines | 28 |
| Message-ID | <mailman.37.1465221424.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> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de zGUgI2H9cmHOmv+v8hQTdAXFmaJihZ3IVFP3r2HL++Hw== |
| Return-Path | <random832@fastmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'expressions': 0.07; '**)': 0.09; 'precedence': 0.09; 'received:internal': 0.09; 'assume': 0.11; '<>.': 0.11; '"and"': 0.16; '"or"': 0.16; '2016': 0.16; 'bitwise': 0.16; 'expressions,': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'operators,': 0.16; 'parentheses': 0.16; 'precedence.': 0.16; 'readers,': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'tripped': 0.16; 'wrote:': 0.16; '(not': 0.20; 'lawrence': 0.22; 'subject:problem': 0.22; 'header:In-Reply-To:1': 0.24; 'discussion': 0.24; 'mon,': 0.24; 'skip:" 20': 0.26; 'equivalent': 0.27; 'arithmetic': 0.29; 'operators': 0.29; 'sure,': 0.29; "i'm": 0.30; 'code': 0.30; 'relative': 0.30; '"the': 0.32; 'getting': 0.33; 'except': 0.34; 'this?': 0.34; 'on,': 0.35; 'ones': 0.35; 'something': 0.35; 'but': 0.36; 'lines': 0.36; 'basic': 0.36; 'monday,': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'aspects': 0.37; 'received:66': 0.38; 'sure': 0.39; 'along': 0.39; 'to:addr:python.org': 0.40; 'header:Message- Id:1': 0.61; 'more': 0.63; 'strictly': 0.64; 'goal': 0.64; 'url:co': 0.65; 'url:2011': 0.75; 'obvious': 0.76; 'url:i': 0.77; 'url:10': 0.79; 'url:jpg': 0.79; 'low': 0.83; 'url:dailymail': 0.91; 'confidence': 0.95 |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=kYSpY/mK4NLRXCRLZYqSXh3xBzg=; b=pHNfBa SHGrk/9chpr2CnUSAC0hO3bHumHGrXnyusgactKqUBKlPh639MqYRtdbvcenMo8E UZuCi0Z7RgOcKZ38RLNXRe0tkvhkz3NFDcBUuPBeQsgTLvloDmgs/0/PCnsHt74i THd5rqQcb6w88jSJeujuFt9FDHLA+YrnP4ST8= |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=kYSpY/mK4NLRXCR LZYqSXh3xBzg=; b=PMpryIDymt54tu3VrIgD6fq8kpMxal2B6ev849nx1ySxcQJ S8r0t9mqGT7F5xjGcagz5+4LhIvq/waTnT9OChVrpUJF1CO/B3HicaZSXgQVkWDm iCFk14wAjfGSVdxJ8ZUWcyESAXQat19q9//Te0BbP895QjHCRMqaK8LFJX6w= |
| X-Sasl-Enc | BCfQ+oXKpKgkliwG4AklmQmELsPSYA1qQlbNVanQUTfG 1465221421 |
| X-Mailer | MessagingEngine.com Webmail Interface - ajax-7f2506ab |
| In-Reply-To | <2a577a90-3a39-4d8f-90fa-4a00fd4f06a3@googlegroups.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 <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 | <1465221421.1069788.629246361.60094337@webmail.messagingengine.com> |
| 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> |
| Xref | csiph.com comp.lang.python:109564 |
Show key headers only | View raw
On Mon, Jun 6, 2016, at 01:46, Lawrence D’Oliveiro wrote: > On Monday, June 6, 2016 at 4:06:20 AM UTC+12, Uri Even-Chen wrote: > > Never write expressions, such as 2 ** 3 ** 2 or even 2 * 4 > > + 5, without parentheses. > > That leads to the code equivalent of > <http://i.dailymail.co.uk/i/pix/2011/10/13/article-2048696-03F82C520000044D-302_634x332.jpg>. Okay, can we settle on, as a principle, "the basic arithmetic operators (not to include **) are the only ones whose precedence can be presumed to be obvious to all readers, and other expressions may/should have parentheses to make it more clear, even when not strictly necessary to the meaning of the expression"? Sure, it's obvious to _me_ that << and >> have higher precedence than & and |, and that "and" has a higher precedence than "or", but can I assume the other people know this? And I don't know offhand the relative precedence of non-conceptually-related groups of operators, except that I'm pretty sure "and" and "or" have very low precedence. [To keep this on-topic, let's assume that this discussion has a goal of getting something along the lines of "always/sometimes/never use "unnecessary" parentheses" into PEP7/PEP8. Speaking of, did you know that C has lower precedence for the bitwise operators &^| than for comparisons? That was something that tripped me up for a very long time and undermined my confidence as to other aspects of the bitwise operators]
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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