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


Groups > comp.lang.python > #69785 > unrolled thread

Re: Yet Another Switch-Case Syntax Proposal

Started byChris Angelico <rosuav@gmail.com>
First post2014-04-07 09:16 +1000
Last post2014-04-07 09:16 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Yet Another Switch-Case Syntax Proposal Chris Angelico <rosuav@gmail.com> - 2014-04-07 09:16 +1000

#69785 — Re: Yet Another Switch-Case Syntax Proposal

FromChris Angelico <rosuav@gmail.com>
Date2014-04-07 09:16 +1000
SubjectRe: Yet Another Switch-Case Syntax Proposal
Message-ID<mailman.8965.1396826189.18130.python-list@python.org>
On Mon, Apr 7, 2014 at 6:13 AM, Michael Torrie <torriem@gmail.com> wrote:
> On 04/06/2014 12:07 PM, Chris Angelico wrote:
>> This has a slight oddity of parsing (in that an expression can
>> normally have a comparison in it); if you really want to use the
>> result of a comparison inside a case block, you'd have to parenthesize
>> it. But it's easy enough to explain to a human.
>
> This syntax is almost identical to the if/elif/else syntax, though, no?

Like I said, it's a short-hand for an if/elif tree, nothing more. Most
of the proposals have effectively been that anyway. There are
differences, though; the case target gets evaluated only once, for
instance. I'm not pushing strongly for its addition to the language.

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web