Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: for / while else doesn't make sense Date: Sat, 21 May 2016 12:31:36 +1000 Lines: 33 Message-ID: References: <573EC62F.4090401@lucidity.plus.com> <573f9322$0$1616$c3e8da3$5496439d@news.astraweb.com> <44ec67e8-0c6e-54d9-c2fc-a4d9b78efb3d@icloud.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de wLe9OJGO+56lcbMRYcywtAlSJUhCidtYxzziHAeV8Qcw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'anyway.': 0.04; '(b)': 0.07; '21,': 0.07; 'differently': 0.07; 'feature.': 0.07; 'javascript,': 0.07; 'cc:addr:python-list': 0.09; 'behave': 0.09; 'derived': 0.09; 'integer,': 0.09; 'ruby,': 0.09; 'statements': 0.09; 'subject:while': 0.09; 'bug': 0.10; 'python': 0.10; 'python.': 0.11; 'language,': 0.11; 'syntax': 0.13; 'languages,': 0.15; 'languages.': 0.15; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lisp,': 0.16; 'loops': 0.16; 'macro': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'rewritten': 0.16; 'subject:make': 0.16; 'wrote:': 0.16; 'string,': 0.18; 'language': 0.19; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '(a)': 0.22; 'fine,': 0.22; 'programming': 0.22; 'am,': 0.23; 'sat,': 0.23; 'header:In-Reply- To:1': 0.24; 'all.': 0.24; 'feature': 0.24; "doesn't": 0.26; 'figure': 0.27; 'message-id:@mail.gmail.com': 0.27; 'restrict': 0.27; 'idea': 0.28; 'looks': 0.29; 'for,': 0.29; 'subset': 0.29; 'wasting': 0.29; 'code': 0.30; '(i.e.,': 0.30; 'another': 0.32; 'language.': 0.32; 'point': 0.33; 'common': 0.33; "d'aprano": 0.33; 'picking': 0.33; 'steven': 0.33; 'surely': 0.33; 'languages': 0.34; 'received:google.com': 0.35; 'trouble': 0.35; 'level': 0.35; 'received:74.125.82': 0.35; 'but': 0.36; 'should': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'thought': 0.37; 'end': 0.39; 'does': 0.39; 'unable': 0.39; 'easily': 0.39; 'some': 0.40; 'high': 0.60; 'your': 0.60; 'share': 0.61; 'avoid': 0.61; 'subject: / ': 0.63; 'different': 0.63; 'specializing': 0.76; 'chrisa': 0.84; 'float,': 0.84; 'perspective,': 0.84; 'subject:else': 0.84; 'subject:sense': 0.84; 'to:none': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc; bh=p2f6gB3WFnxOsizrQ1uMczNI0PK/MKGe5woEnxy8ShU=; b=Tm0qz6kv6/4cQ0ARiQD4i7KDgMXgAlVvyLI1Sk6+4KBPvSIrdt48lHs5+sOCHZZHFH 0zgw+GrADwibIcGYSJtWQpFBG1r2qsxWoLwVFeH0+5Qch0qarNOVuCkOGcJaN+bj8JPm m5kj63XMfTYbqEHMRcRkKKD19OVY2/bCUdZq50c8GcpShYcYI3q5Cw33gKQyS+CEnmQQ GwrDTeY+potBnP3jzcgrfBTVL8UOXTPDwxN0WaujcngITcU0nLjrTzcoOiqxDnULSaV8 tjF9LKY6hRMPLxlIHSnqA9nsiCjWOq3oNZ5BP0RYqsiqKBUQ154Tb6K7GJbNzHrvx2uN sSuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=p2f6gB3WFnxOsizrQ1uMczNI0PK/MKGe5woEnxy8ShU=; b=RNo2YwEC/Bxvo/I1nbTAHBtkKZggN29zc6rTbY0Xay3Ovyy/GR8dPCMuXISr7gN0Mr Xqp9A2EAZBEksChABWMZsWbdoKEILB3OQljsZPZXSoNIc4VxC7jOfKcqVPEYuhqB/SXa L6134tNk9KVkW/H7ABeC7wrlErHjBJsSAtg+Pj9cd4L6dK2XK3KfEvZNKuKhZMjCSVcx srrSfXN41IxRudFCh8eDQgrJZ6y/3EAAQjhY8W2dZyLjsb+02RlG49Mb3azN6L5NpqjE eTrROHAYhMD1hpPBxygmUHlmnX4PwlvbucaZc5J66IjfzDQzVjrKOHoUvvbSZBnuPS66 BZ/Q== X-Gm-Message-State: AOPr4FXD3/WteQldMQH+pcpTIp4Kxq19l+ItR0iT/t3w84+lFjy6VMB2MiQ69xZ9Yje5cK60hwPvhzHmp//3zw== X-Received: by 10.194.110.234 with SMTP id id10mr5949992wjb.30.1463797896669; Fri, 20 May 2016 19:31:36 -0700 (PDT) In-Reply-To: <44ec67e8-0c6e-54d9-c2fc-a4d9b78efb3d@icloud.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <573EC62F.4090401@lucidity.plus.com> <573f9322$0$1616$c3e8da3$5496439d@news.astraweb.com> <44ec67e8-0c6e-54d9-c2fc-a4d9b78efb3d@icloud.com> Xref: csiph.com comp.lang.python:108887 On Sat, May 21, 2016 at 11:23 AM, Christopher Reimer wrote: > On 5/20/2016 3:43 PM, Steven D'Aprano wrote: > >> But the idea that you should avoid a Python feature while programming in >> Python because Javascript doesn't have it, or Ruby, or C, is surely the >> height of muddleheaded thinking. You're not programming Javascript, Ruby >> or >> C, you're programming in Python. The whole point of picking one language >> over another is to get access to the tools and features that language >> offers. Otherwise you're just wasting your time. > > > For many years I have resisted specializing in a programming language, as I > can easily write any program in pseudo code and figure out the syntax for a > particular language. Now it does help that most languages have derived from > C and share a common feature set (i.e., string, integer, float, if/else, > while, for, etc.). From my perspective, tacking on an else block to the end > of a for or while loop looks like a bug or a not very well thought out > feature. If I was translating a Python program with for/else or while/else > statements into a different language, those statements will have to be > rewritten anyway. That's fine, as long as you (a) restrict your programming languages to those derived from C, and (b) restrict your programming style to the common subset of them all. Trouble is, that "common subset" is actually pretty small. Strings behave very differently in C and high level languages, and for loops are *very* different in different languages. So you'd be throwing out a large amount of expressiveness, plus you're completely unable to use languages built on some other model (eg LISP, or DeScribe Macro Language, or APL). ChrisA