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


Groups > comp.lang.python > #67945

Re: Ternary operator associativity

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <torriem+gmail@torriefamily.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; '(except': 0.07; 'bug.': 0.09; 'subject:skip:a 10': 0.09; 'tests,': 0.09; 'python': 0.11; 'assume': 0.14; 'comparisons,': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'left,': 0.16; 'precedence': 0.16; 'ternary': 0.16; 'language': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'header:User-Agent:1': 0.23; 'compare': 0.26; 'right.': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'grouping': 0.31; 'operators': 0.31; 'languages': 0.32; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'according': 0.40; 'chain': 0.60; 'mentioned': 0.61; 'skip:n 10': 0.64; 'day': 0.76
X-Virus-Scanned amavisd-new at torriefamily.org
Date Thu, 06 Mar 2014 10:47:25 -0700
From Michael Torrie <torriem@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11
MIME-Version 1.0
To python-list@python.org
Subject Re: Ternary operator associativity
References <f3bd8da6-dc2e-4b05-b50b-3a2c9d825367@googlegroups.com>
In-Reply-To <f3bd8da6-dc2e-4b05-b50b-3a2c9d825367@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Newsgroups comp.lang.python
Message-ID <mailman.7869.1394128061.18130.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1394128062 news.xs4all.nl 2913 [2001:888:2000:d::a6]:54688
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:67945

Show key headers only | View raw


On 03/06/2014 04:34 AM, candide wrote:
> According to the official documentation, the ternary operator has left-to-right associativity :
> 
> -------------------
> Operators in the same box group left to right (except for comparisons, including tests, which all have the same precedence and chain from left to right -- see section Comparisons -- and exponentiation, which groups from right to left).
> -------------------
> 
> 
> Nevertheless, the ternary operator grouping seems to be from right to left, compare :

I was reading a blog about PHP the other day and it mentioned PHP was
the only language he knew of that had ternary operator precedence going
left to right.  All other languages use right to left.  So I assume that
Python also uses right to left and that the documentation is a bug.

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


Thread

Ternary operator associativity candide <c.candide@laposte.net> - 2014-03-06 03:34 -0800
  Re: Ternary operator associativity Michael Torrie <torriem@gmail.com> - 2014-03-06 10:47 -0700
  Re: Ternary operator associativity Terry Reedy <tjreedy@udel.edu> - 2014-03-06 13:52 -0500
  Re: Ternary operator associativity Tim Chase <python.list@tim.thechases.com> - 2014-03-06 12:59 -0600
  Re: Ternary operator associativity Terry Reedy <tjreedy@udel.edu> - 2014-03-06 15:15 -0500

csiph-web