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


Groups > comp.lang.python > #69604

Re: Yet Another Switch-Case Syntax Proposal

Date 2014-04-03 11:23 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: Yet Another Switch-Case Syntax Proposal
References <8084-1396540962-768613@sneakemail.com>
Newsgroups comp.lang.python
Message-ID <mailman.8852.1396550862.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 04/03/2014 09:02 AM, Lucas Malor wrote:
>
> In reply to Ian Kelly:
>>
>> Instead of disabling fallthrough by default, why not disable it all together?
>
> I was tempted but there are cases in which it's useful. An example
>
> switch day casein ("Monday", "Thursday", "Wednesday", "Tuesday", "Friday"):
>      gotowork = True
>      continue
> casein ("Monday", "Thursday", "Wednesday", "Tuesday", "Friday"):
>      daytype = "ferial"
> casein ("Saturday", "Sunday")
>      daytype = "festive"


Absolutely not.  Currently, the 'continue' key word means "stop processing and go back to the beginning".  You would 
have it mean "keep going forward".  Thus 'continue' would mean both "go backwards" and "go forwards" and would lead to 
unnecessary confusion.

--
~Ethan~

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


Thread

Re: Yet Another Switch-Case Syntax Proposal Ethan Furman <ethan@stoneleaf.us> - 2014-04-03 11:23 -0700
  Re: Yet Another Switch-Case Syntax Proposal Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-04-04 08:33 +0000
    Re: Yet Another Switch-Case Syntax Proposal Marko Rauhamaa <marko@pacujo.net> - 2014-04-04 12:46 +0300
      Re: Yet Another Switch-Case Syntax Proposal Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-04 10:02 -0600
        Re: Yet Another Switch-Case Syntax Proposal Marko Rauhamaa <marko@pacujo.net> - 2014-04-04 19:44 +0300
          Re: Yet Another Switch-Case Syntax Proposal Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-04 11:55 -0600

csiph-web