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


Groups > comp.lang.python > #69570

Re: Yet Another Switch-Case Syntax Proposal

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.043
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'else:': 0.03; 'things,': 0.09; '"in"': 0.16; 'iterable,': 0.16; 'of"': 0.16; 'subject:Case': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'seems': 0.21; 'switch': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'message-id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'keywords,': 0.31; 'steven': 0.31; "we're": 0.32; 'received:google.com': 0.35; 'add': 0.35; 'vice': 0.36; 'should': 0.36; 'too': 0.37; 'two': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'different': 0.65; 'equals': 0.68; 'subject:Proposal': 0.91; 'write:': 0.91
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=a+o95ohAeZgIoztn37rdP8w+bnxfabIeLqDKCmyaZok=; b=RWnzmSV9riZadMgWpREOnrOcKkpFPDjG255XNrX2EvzjVP7aa9Ss++0OwmgfL7KNk0 6cIcCCfrPwUoKv6rxoooupmw+CYoTk0+jDOSGdnLgBG1OAkM3Wmr9wPZTpcdJ8uwCEau xjHD/W0cBxa4LWqdcgcdi+dqGL3QSnDPZxNvXQCrr9Q7HiO0DCYs7/pXgg35VzkYCLrn tpqd0wgsq6Kr6YINBEsxHh9cfKz8Jv43WXPQOTXL/DBXmkL2PQbWXHhuUyAluz3JQM1V oM1slv+YteB3+MIABnrZuey9Dr4cHCgTfq09YQ0MkkojmQ1thh3BEkrygfp8xu9eoQhL BBlw==
X-Received by 10.66.240.70 with SMTP id vy6mr5321233pac.80.1396507884988; Wed, 02 Apr 2014 23:51:24 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <533cb3fd$0$2909$c3e8da3$76491128@news.astraweb.com>
References <12008-1396450399-453900@sneakemail.com> <mailman.8822.1396475455.18130.python-list@python.org> <533cb3fd$0$2909$c3e8da3$76491128@news.astraweb.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 3 Apr 2014 00:50:44 -0600
Subject Re: Yet Another Switch-Case Syntax Proposal
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
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.8826.1396507894.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1396507894 news.xs4all.nl 2928 [2001:888:2000:d::a6]:55203
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:69570

Show key headers only | View raw


On Wed, Apr 2, 2014 at 7:06 PM, Steven D'Aprano <steve@pearwood.info> wrote:
> If we're going to add "switch" and "case" keywords, how about we also add
> "of"? Then we can write:
>
> switch x case of a, b, c:
>     # x equals one of a, b or c
> case of d, e, f:
>     # x equals one of d, e or f
> case in g, h, i:
>     # g, h and i must be iterable, and x is in one of them
> else:
>     # none of the above match

I don't think I like the idea of having "case in" and "case of"
meaning two different things, particularly since the one that you have
labeled with "of" is the one that I think should use "in" and vice
versa.  Seems like too much potential for confusion here.

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


Thread

Re: Yet Another Switch-Case Syntax Proposal Chris Angelico <rosuav@gmail.com> - 2014-04-03 08:50 +1100
  Re: Yet Another Switch-Case Syntax Proposal Steven D'Aprano <steve@pearwood.info> - 2014-04-03 01:06 +0000
    Re: Yet Another Switch-Case Syntax Proposal Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-03 00:50 -0600

csiph-web