Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail 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; 'operator': 0.05; '(especially': 0.07; 'bind': 0.09; 'php,': 0.09; 'precedence': 0.09; '(usually)': 0.16; 'forget.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'roy': 0.16; 'sane': 0.16; 'tighter': 0.16; 'trivia': 0.16; "\xa0it's": 0.16; 'mon,': 0.16; 'wrote:': 0.16; 'language,': 0.17; 'language': 0.17; 'header:In- Reply-To:1': 0.22; 'pm,': 0.24; 'aug': 0.24; "i'm": 0.27; 'tend': 0.28; 'universal': 0.29; 'message-id:@mail.gmail.com': 0.29; 'fairly': 0.30; 'operations': 0.30; 'brain': 0.30; 'table.': 0.30; 'changing': 0.31; 'to:addr:python-list': 0.33; 'rule': 0.34; 'symbol': 0.34; 'pretty': 0.35; 'languages': 0.37; 'put': 0.37; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'else': 0.39; 'to:addr:python.org': 0.39; "it's": 0.40; 'more': 0.60; 'order': 0.62; 'details': 0.65; 'subject:line': 0.73; '*for': 0.84; 'demand,': 0.84; 'often,': 0.84; 'remembering': 0.84; 'or:': 0.91; 'investing': 0.97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=MMaV2+zM8SircuShzluEJQ3ZnrPc0xr063Vkd+pul5w=; b=j3GaUwHDM7tl3Z1fyS97rWIYkhc/YH4IhV4GNzrU2/9yJVq2qeiw4rzt2E24xEML7U gFltI6hve1uEPVRGqrgGNMr9Ai5NG96UBorwGZflvZcjTO2T97MUJWH0C09yBqBzoHol afeNHjBr17JiAxxw03G7AnEWj5eVEPKtbqMCM= MIME-Version: 1.0 In-Reply-To: References: <1312951356.77394.YahooMailNeo@web121518.mail.ne1.yahoo.com> <1312981104.89312.YahooMailNeo@web121520.mail.ne1.yahoo.com> <1312982377.95657.YahooMailNeo@web121508.mail.ne1.yahoo.com> <87fwl9hr4r.fsf@benfinney.id.au> <4e43cb2a$0$29986$c3e8da3$5496439d@news.astraweb.com> <74c2421f-28a0-4a8d-bf74-4eebacfb74f1@d7g2000vbv.googlegroups.com> <92b8f192-d7fc-4c60-87ad-71b12652f3a2@k8g2000yqk.googlegroups.com> Date: Mon, 15 Aug 2011 15:16:55 +0100 Subject: Re: allow line break at operators From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1313417818 news.xs4all.nl 23961 [2001:888:2000:d::a6]:47758 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:11460 On Mon, Aug 15, 2011 at 2:41 PM, Roy Smith wrote: > Demand, no, but sometimes it's a good idea. =A0I've been writing computer > programs for close to 40 years, and I still have no clue what most of > the order of operations is. =A0It's just not worth investing the brain > cells to remember such trivia (especially since the details change from > language to language). =A0Beyond remembering the (apparently) universal > rule that {*, /} bind tighter than {+, -}, I pretty much just punt on > everything else and put in extra parens everywhere. > Understandable. I go the other way, though, and keep an operator precedence table for each language handy; often, what I'm after is not "which one binds more tightly", but "what's the symbol for modulo", which is also (usually) on that same table. Or: "Blasted PHP, which operators have precedence between || and or?" which is easy to forget. And you're right about the details changing from language to language, hence the operators table *for each language*. But most languages follow fairly sane rules, and tend to come up with pretty much the same ordering. ChrisA