Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Mark Lawrence Newsgroups: comp.lang.python Subject: Re: Case Statements Date: Tue, 15 Mar 2016 23:11:17 +0000 Lines: 34 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de WcKvEHZ+I0P0ibLPAim4XgOZeba4kuADWcnExsV/cOqg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'pycon': 0.03; 'from:addr:yahoo.co.uk': 0.05; 'reject': 0.05; 'rejected': 0.05; 'keynote': 0.07; 'compact': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'poll': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'statements,': 0.16; 'thought.': 0.16; 'wrote:': 0.16; 'language': 0.19; 'versions': 0.20; 'suggested': 0.20; 'lawrence': 0.22; 'select': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'sequence': 0.27; 'url:peps': 0.29; 'print': 0.30; 'url:wiki': 0.30; 'skip:[ 10': 0.31; 'embedded': 0.32; 'language.': 0.32; 'url:python': 0.33; 'usually': 0.33; 'url:dev': 0.35; 'something': 0.35; 'there': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; '2007': 0.38; 'to:addr:python.org': 0.40; 'mark': 0.40; 'future': 0.60; 'chance': 0.60; 'email addr:gmail.com': 0.62; 'charset:windows-1252': 0.62; 'more': 0.63; 'our': 0.64; 'url:cgi': 0.66; 'therefore': 0.67; 'pythonistas,': 0.84; 'adopt': 0.91; 'lists:': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: 80.234.129.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104961 On 15/03/2016 20:46, jj0gen0info@gmail.com wrote: > Given that "Case Statements" are more compact and less redundant than a sequence of if-elif statements, and usually can contain embedded match lists: > Is there any chance future versions of Python will adopt a case structure? > > Something like > > select x > case in [1,2,3,5,7,9] > print .... > case in [4,6,8] > print .... > case else > print .... > > Just a thought. > > JJ > Been suggested and rejected via https://www.python.org/dev/peps/pep-3103/ and https://www.python.org/dev/peps/pep-0275/. The "Rejection Notice" section of the former states "A quick poll during my keynote presentation at PyCon 2007 shows this proposal has no popular support. I therefore reject it.". See also http://c2.com/cgi/wiki?SwitchStatementsSmell -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence