Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.069 X-Spam-Evidence: '*H*': 0.86; '*S*': 0.00; 'subject:test': 0.09; 'python': 0.11; '"standard': 0.16; 'ternary': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'written': 0.21; 'closely': 0.24; 'versions': 0.24; "i've": 0.25; 'mention': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; '25,': 0.31; 'becoming': 0.31; 'probably': 0.32; 'quite': 0.32; 'style': 0.33; 'received:google.com': 0.35; 'being': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'more': 0.64; 'batchelder': 0.84; 'idiom': 0.84; 'subject::': 0.85 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:to :content-type; bh=pUaB3TAKs5B1vSh9MGb+/x9ATLRbY6ZdkIdrXY9UyIA=; b=NfGRnZsEKRefC9LHQxuH+aMegfnkaZDOccYqP7DH1wMLt7ZWhEk8syT/qhPZSYUOZI LRP3FXPY9cUkS1pcARNS+FbJM1j0llsm8O7bktyFaoVU6qlpbsOgOlFS9RUjBcNXmVlw pCZ1/roIaN2BTAW34BeKWVmG2vJiYmeRKzxnTcWgp5t1rL2+s8cQx0OTtvRgrEFhZKo6 cXrbGLuFKjOKJ6TCaZ54f0rQIijND8QgbzPqIst9Z+41EMiaUkHcux2z4bodjjaCU2Gz e1hu6PnPpyQy60f36zRc4avCGxVKyEs8UP15Y+JUHlp2AKf8tSsOElSzGbO4hnRqTNsg QXYg== X-Received: by 10.70.65.68 with SMTP id v4mr248301pds.156.1414245257609; Sat, 25 Oct 2014 06:54:17 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <54476af8$0$21651$426a74cc@news.free.fr> <7839376e-fc27-4299-ae63-4ddf17ef9a8a@googlegroups.com> <7d2ea3c1-504e-4f5c-8338-501b1483df38@googlegroups.com> <878uk6x5nd.fsf@elektro.pacujo.net> <544a1016$0$13000$c3e8da3$5496439d@news.astraweb.com> <544b2f15$0$12978$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Sat, 25 Oct 2014 07:53:37 -0600 Subject: Re: (test) ? a:b To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414245766 news.xs4all.nl 2877 [2001:888:2000:d::a6]:50186 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79669 On Sat, Oct 25, 2014 at 5:58 AM, Ned Batchelder wrote: > You mention "standard Python idioms." I think this style of > conditional-via-indexing is becoming quite uncommon, and is no longer one of > the standard Python idioms. This is now in the category of "outdated hack." I think that's probably true. And even in code written for versions of Python than predate the ternary, I think I've seen the idiom "(cond and [if_true] or [if_false])[0]" more often than the one being discussed -- perhaps because it more closely resembles the format of the C ternary