Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97081
| Path | csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.026 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'indexing': 0.07; 'cc:addr :python-list': 0.09; 'subject:python': 0.14; 'evaluates': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'operator.': 0.16; 'semantically': 0.16; 'ternary': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'names.': 0.22; 'sep': 0.22; 'am,': 0.23; 'second': 0.24; 'header:In-Reply-To:1': 0.24; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'list': 0.34; 'received:google.com': 0.35; 'false': 0.35; 'instead': 0.36; 'subject:: ': 0.37; 'of:': 0.66; "they're": 0.66; 'evaluate': 0.72; 'chrisa': 0.84; 'todd': 0.84; 'to:none': 0.91; 'careful': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=JBordqougQuN1uQxiQ3Br49gksv+RYQ7TlSgajnTsL8=; b=KEYDPF42wSBRqNUQkj5REKXckOMzMs141kt21PO37kVLMdGUv+YCdUx63oukVVNWtI 9dqnmYIEolmtC3yDQJjl5K/ptH9XC8mrFMQrQXJjiInaQyP9vXN6ycaUgHdKoyBnLf/y Iy7hkLa8i8USed/rV2Vte+i3nYn5q0Jjp5i4mSCAOnPHFxqYzrFLgl2ADl7HBBKz88XX oSwebU86ImF7YNNGbkEGTEhhi2Xl3ArU+r6wGIhqybiG0hUw21POh0ZNGpu8h9HDsNC+ MElt2V+qp7/LiLsiuA5juYNuauqmViJfM+DA+9AahXmN9+IatbMxIwxD9+NikySuLWbZ SCrw== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.178.145 with SMTP id cy17mr31681968igc.92.1443113874282; Thu, 24 Sep 2015 09:57:54 -0700 (PDT) |
| In-Reply-To | <CAFpSVp++O=v0QPaLqpawmpxL3vxinJuqGx0HmW8v2Pjm3e8qhQ@mail.gmail.com> |
| References | <560391ea$0$2885$c3e8da3$76491128@news.astraweb.com> <CAFpSVp++O=v0QPaLqpawmpxL3vxinJuqGx0HmW8v2Pjm3e8qhQ@mail.gmail.com> |
| Date | Fri, 25 Sep 2015 02:57:54 +1000 |
| Subject | Re: Idiosyncratic python |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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.136.1443113877.28679.python-list@python.org> (permalink) |
| Lines | 15 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1443113877 news.xs4all.nl 23844 [2001:888:2000:d::a6]:56820 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:97081 |
Show key headers only | View raw
On Fri, Sep 25, 2015 at 2:54 AM, Todd <toddrjen@gmail.com> wrote: > Using list indexing with booleans in place of a ternary operator. > > a = False > b = [var2, var1][a] > > Instead of: > > b = var1 if a else var2 Be careful - these are not semantically identical. The first one evaluates both var1 and var2, while the second will evaluate only the one it needs. This might be significant if they're not simple names. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Idiosyncratic python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-09-24 16:02 +1000
Re: Idiosyncratic python Paul Rubin <no.email@nospam.invalid> - 2015-09-23 23:16 -0700
Re: Idiosyncratic python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-09-24 16:35 +1000
Re: Idiosyncratic python Ben Finney <ben+python@benfinney.id.au> - 2015-09-24 16:54 +1000
Re: Idiosyncratic python Steven D'Aprano <steve@pearwood.info> - 2015-09-25 11:08 +1000
Re: Idiosyncratic python Terry Reedy <tjreedy@udel.edu> - 2015-09-24 02:54 -0400
Re: Idiosyncratic python wxjmfauth@gmail.com - 2015-09-24 00:06 -0700
Re: Idiosyncratic python Laurent Pointal <laurent.pointal@free.fr> - 2015-09-24 19:50 +0200
Re: Idiosyncratic python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-24 21:05 +0100
Re: Idiosyncratic python jmp <jeanmichel@sequans.com> - 2015-09-24 11:12 +0200
Re: Idiosyncratic python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-24 14:09 +0100
Re: Idiosyncratic python jmp <jeanmichel@sequans.com> - 2015-09-24 16:07 +0200
Re: Idiosyncratic python Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-24 08:26 -0600
Re: Idiosyncratic python Chris Angelico <rosuav@gmail.com> - 2015-09-25 02:57 +1000
Re: Idiosyncratic python jmp <jeanmichel@sequans.com> - 2015-09-24 20:04 +0200
Re: Idiosyncratic python Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-24 12:19 -0600
Re: Idiosyncratic python Ned Batchelder <ned@nedbatchelder.com> - 2015-09-24 13:46 -0700
Re: Idiosyncratic python Laura Creighton <lac@openend.se> - 2015-09-24 23:08 +0200
Re: Idiosyncratic python Chris Angelico <rosuav@gmail.com> - 2015-09-25 07:49 +1000
Re: Idiosyncratic python Steven D'Aprano <steve@pearwood.info> - 2015-09-25 10:55 +1000
Re: Idiosyncratic python sohcahtoa82@gmail.com - 2015-09-24 15:32 -0700
Re: Idiosyncratic python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-25 00:40 +0100
Re: Idiosyncratic python Akira Li <4kir4.1i@gmail.com> - 2015-09-25 03:04 +0300
Re: Idiosyncratic python Steven D'Aprano <steve@pearwood.info> - 2015-09-25 10:08 +1000
csiph-web