Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.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: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'else:': 0.03; 'operator': 0.03; 'subject:Python': 0.06; 'odd': 0.07; 'variables': 0.07; 'variant': 0.09; "wouldn't": 0.14; '"in"': 0.16; 'blocks': 0.16; 'dictionaries': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'optimised': 0.16; 'pythonic': 0.16; 'readable': 0.16; 'subject:user': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'select': 0.22; 'header:User-Agent:1': 0.23; 'certainly': 0.24; 'simpler': 0.24; 'switch': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'point': 0.28; 'statement': 0.30; 'concise': 0.31; 'indentation': 0.31; 'class': 0.32; 'probably': 0.32; 'languages': 0.32; 'quite': 0.32; 'cases': 0.33; 'basic': 0.35; 'but': 0.35; 'really': 0.36; 'largely': 0.36; 'useful': 0.36; 'subject:New': 0.37; 'to:addr :python-list': 0.38; 'flow': 0.39; 'to:addr:python.org': 0.39; 'subject: / ': 0.60; 'most': 0.60; 'limited.': 0.61; "you're": 0.61; 'advanced': 0.63; 'more': 0.64; 'different': 0.65; 'header :Reply-To:1': 0.67; 'statement,': 0.68; 'reply-to:no real name:2**0': 0.71; 'dialect': 0.84; 'reply-to:addr:python.org': 0.84; 'weaker': 0.84; '2013': 0.98 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=J66TsmXS c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=2LCq-pQfA8cA:10 a=kol9C2CqbGIA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=adEEMCnIg5IA:10 a=fWeY_1AEKKn0MZmVkU8A:9 a=wPNLvfGTeEIA:10 X-AUTH: mrabarnett:2500 Date: Sun, 10 Nov 2013 00:50:11 +0000 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: New user's initial thoughts / criticisms of Python References: <-JadnUirYuhUruPPnZ2dnUVZ8rSdnZ2d@bt.com> <1aed3f12-6802-48fa-b149-f2a84b8149b7@googlegroups.com> In-Reply-To: <1aed3f12-6802-48fa-b149-f2a84b8149b7@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384044614 news.xs4all.nl 15918 [2001:888:2000:d::a6]:50944 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:58977 On 09/11/2013 22:44, Jonathan wrote: > On Saturday, November 9, 2013 8:27:02 AM UTC-5, Joshua Landau wrote: > >> `select` is quite an odd statement, in that in most cases it's just a >> weaker variant of `if`. By the time you're at the point where a >> `select` is actually more readable you're also at the point where a >> different control flow is probably a better idea. Things like >> dictionaries or a variables pointing to functions are really useful >> and can be encapsulated in a class quite well. This is a bit more >> advanced but largely more rigorous. >> >> But most of the time the idea is just that an `if` is more explicit, >> and it's not like a `case` statement can be optimised as it can in >> lower-level languages with simpler datatypes. > > The C switch statement is very limited. The select statement in the dialect of BASIC I regularly use is more flexible. It's more concise on long if chains because it elides the "end if"s. But the use of indentation for blocks and the "in" operator certainly reduce the need for it in Python. > > In pythonic syntax: > > select : > case ,[],: > .... > .... > case else: > [snip] It's more likely that the cases would be indented the same amount as the 'select', and you wouldn't need 'case else', just 'else'.