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


Groups > comp.lang.python > #79015

Re: Toggle

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!lightspeed.eweka.nl!lightspeed.eweka.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!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.040
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'problem:': 0.07; 'bug.': 0.09; 'default.': 0.09; 'feature,': 0.09; 'feature.': 0.09; 'subtle': 0.09; 'cc:addr:python-list': 0.11; 'bug': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'slightly': 0.19; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; '13,': 0.31; 'default,': 0.31; "i'd": 0.34; 'received:google.com': 0.35; 'behind': 0.37; 'solving': 0.38; 'expect': 0.39; 'most': 0.60; 'providing': 0.61; 'times': 0.62; 'more': 0.64; 'different': 0.65; 'life': 0.66; 'default': 0.69; 'bite': 0.84; 'colour': 0.84; 'easier,': 0.84; "it'd": 0.84; 'to:none': 0.92
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=xg7HHcA2cyKSMz40sbxVBkf6KsG8NF07olBkUIyIz08=; b=SgGXKr3Y/pLwEF2nvHr1LO/cdn70tvsm+sHpG6x1uzMNg3/8fXeKJmELhdGohWitj9 uK2u0wwpnEBY7aOII7h4ArB3arDVvDGBx2m/6GaPUDlbtkqnev0FWWFvK3NQCqp8c+CU Pg6w116FiRGzKhArQahzS5WPdv6BZOt1dU+zoEBEHshWvlwshmsA0e4u+xKqi0RrnKZs HtacXGEDtbnhrXmDCXcOIIG6ZBi/R9mDGvD0JdPPtsiWGtENDCZmdkb1dMTlwKEd4c2E JMb2i19fq6npvkOlrgy6+s+BglSK2mB/rCtSOa/t3YwjMrNpmqydtf5gUVjFdHAYuwsu ZfRw==
MIME-Version 1.0
X-Received by 10.50.102.106 with SMTP id fn10mr24589743igb.14.1413139390621; Sun, 12 Oct 2014 11:43:10 -0700 (PDT)
In-Reply-To <543acaa2$0$12115$b1db1813$79461190@news.astraweb.com>
References <u5kb3alsoleq8lh3eos289h5593m8033og@4ax.com> <c9mit0FqujlU1@mid.individual.net> <9MxZv.411008$J62.18700@fx03.am4> <543acaa2$0$12115$b1db1813$79461190@news.astraweb.com>
Date Mon, 13 Oct 2014 05:43:10 +1100
Subject Re: Toggle
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.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.14799.1413139393.18130.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1413139393 news.xs4all.nl 2858 [2001:888:2000:d::a6]:60259
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 3737
X-Received-Body-CRC 295452330
Xref csiph.com comp.lang.python:79015

Show key headers only | View raw


On Mon, Oct 13, 2014 at 5:38 AM, Tony the Tiger <tony@tiger.invalid> wrote:
>> colour = 'red' if colour == 'blue' else 'blue'
>
> I call that a subtle bug that most likely will jump up and bite your
> behind when you least expect it.

More generally, I'd say that this is solving a (very) slightly
different problem: it's providing a "toggle with default" feature,
where the part after the else is the default. If you don't want a
default, that's a bug. I've known times when that default makes life a
lot easier, in which case it'd be a feature.

ChrisA

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


Thread

Toggle Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-08 20:11 -0400
  Re: Toggle Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-09 12:29 +1100
    [OT] spelling colour / color was Re: Toggle mm0fmf <none@mailinator.com> - 2014-10-09 18:43 +0100
      Re: [OT] spelling colour / color was Re: Toggle duncan smith <buzzard@invalid.invalid> - 2014-10-09 19:24 +0100
        Re: [OT] spelling colour / color was Re: Toggle Tim Delaney <timothy.c.delaney@gmail.com> - 2014-10-10 06:53 +1100
          Re: [OT] spelling colour / color was Re: Toggle Marko Rauhamaa <marko@pacujo.net> - 2014-10-09 23:48 +0300
            Re: [OT] spelling colour / color was Re: Toggle alister <alister.nospam.ware@ntlworld.com> - 2014-10-10 17:31 +0000
              Re: [OT] spelling colour / color was Re: Toggle Marko Rauhamaa <marko@pacujo.net> - 2014-10-10 22:01 +0300
                Re: [OT] spelling colour / color was Re: Toggle alister <alister.nospam.ware@ntlworld.com> - 2014-10-10 20:05 +0000
                Re: [OT] spelling colour / color was Re: Toggle Christian Gollwitzer <auriocus@gmx.de> - 2014-10-11 11:37 +0200
                Re: [OT] spelling colour / color was Re: Toggle mm0fmf <none@mailinator.com> - 2014-10-11 12:45 +0100
                Re: [OT] spelling colour / color was Re: Toggle duncan smith <buzzard@invalid.invalid> - 2014-10-11 16:26 +0100
                Re: [OT] spelling colour / color was Re: Toggle Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-11 15:20 -0400
                Re: [OT] spelling colour / color was Re: Toggle William Ray Wing <wrw@mac.com> - 2014-10-11 15:55 -0400
                Re: [OT] spelling colour / color was Re: Toggle duncan smith <buzzard@invalid.invalid> - 2014-10-12 00:40 +0100
                Re: [OT] spelling colour / color was Re: Toggle giacomo boffi <pecore@pascolo.net> - 2014-10-18 09:06 +0200
                Re: [OT] spelling colour / color was Re: Toggle Simon Ward <simon+python@bleah.co.uk> - 2014-10-11 15:45 +0100
        Re: [OT] spelling colour / color was Re: Toggle "Neil D. Cerutti" <neilc@norwich.edu> - 2014-10-10 10:46 -0400
        Re: [OT] spelling colour / color was Re: Toggle Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-10 18:45 +0100
      Re: [OT] spelling colour / color was Re: Toggle Terry Reedy <tjreedy@udel.edu> - 2014-10-09 18:53 -0400
        Re: [OT] spelling colour / color was Re: Toggle Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-10 18:11 +1100
          Re: [OT] spelling colour / color was Re: Toggle Marko Rauhamaa <marko@pacujo.net> - 2014-10-10 13:08 +0300
            Re: [OT] spelling colour / color was Re: Toggle Chris Angelico <rosuav@gmail.com> - 2014-10-10 21:40 +1100
              Re: [OT] spelling colour / color was Re: Toggle Marko Rauhamaa <marko@pacujo.net> - 2014-10-10 13:51 +0300
                Re: [OT] spelling colour / color was Re: Toggle Chris Angelico <rosuav@gmail.com> - 2014-10-10 22:50 +1100
                Re: [OT] spelling colour / color was Re: Toggle Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-10 20:19 -0400
                Re: [OT] spelling colour / color was Re: Toggle Marko Rauhamaa <marko@pacujo.net> - 2014-10-11 13:33 +0300
                Re: [OT] spelling colour / color was Re: Toggle Chris Angelico <rosuav@gmail.com> - 2014-10-11 22:03 +1100
      Re: [OT] spelling colour / color was Re: Toggle Chris Angelico <rosuav@gmail.com> - 2014-10-10 10:21 +1100
      Re: [OT] spelling colour / color was Re: Toggle Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-10 17:52 +1100
        Re: [OT] spelling colour / color was Re: Toggle Chris Angelico <rosuav@gmail.com> - 2014-10-10 18:04 +1100
      Re: [OT] spelling colour / color was Re: Toggle Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-10 18:38 +0100
  Re: Toggle Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-09 02:25 +0100
  Re:Toggle Dave Angel <davea@davea.name> - 2014-10-08 21:24 -0400
  Re: Toggle Ben Finney <ben+python@benfinney.id.au> - 2014-10-09 12:42 +1100
    Re: Toggle Rustom Mody <rustompmody@gmail.com> - 2014-10-08 19:34 -0700
      Re: Toggle Steven D'Aprano <steve@pearwood.info> - 2014-10-09 04:56 +0000
        Re: Toggle Rustom Mody <rustompmody@gmail.com> - 2014-10-08 22:39 -0700
          Re: Toggle Chris Angelico <rosuav@gmail.com> - 2014-10-09 16:55 +1100
          Re: Toggle Peter Otten <__peter__@web.de> - 2014-10-09 09:51 +0200
            Re: Toggle Rustom Mody <rustompmody@gmail.com> - 2014-10-09 05:42 -0700
              Re: Toggle Terry Reedy <tjreedy@udel.edu> - 2014-10-09 16:57 -0400
          Re: Toggle Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-10 18:18 +1100
            Re: Toggle Rustom Mody <rustompmody@gmail.com> - 2014-10-10 07:24 -0700
              Re: Toggle Rustom Mody <rustompmody@gmail.com> - 2014-10-10 07:28 -0700
                Re: Toggle Chris Angelico <rosuav@gmail.com> - 2014-10-11 01:36 +1100
      Re: Toggle Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-09 10:07 -0600
        Re: Toggle Rustom Mody <rustompmody@gmail.com> - 2014-10-09 09:33 -0700
          Re: Toggle Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-10 18:15 +1100
  Re: Toggle Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-09 04:02 +0100
  Re: Toggle random832@fastmail.us - 2014-10-08 23:54 -0400
  Re: Toggle Chris Angelico <rosuav@gmail.com> - 2014-10-09 14:57 +1100
  Re: Toggle Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-10-09 17:57 +1300
    Re: Toggle Travis Griggs <travisgriggs@gmail.com> - 2014-10-08 22:38 -0700
    Re: Toggle alister <alister.nospam.ware@ntlworld.com> - 2014-10-09 15:23 +0000
      Re: Toggle Tony the Tiger <tony@tiger.invalid> - 2014-10-12 18:38 +0000
        Re: Toggle Chris Angelico <rosuav@gmail.com> - 2014-10-13 05:43 +1100
          Re: Toggle alister <alister.nospam.ware@ntlworld.com> - 2014-10-13 08:09 +0000
  Re: Toggle Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-10-10 13:44 +0200

csiph-web