Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: for / while else doesn't make sense Date: Sat, 21 May 2016 10:21:34 +1000 Lines: 52 Message-ID: References: <573EC62F.4090401@lucidity.plus.com> <573f9322$0$1616$c3e8da3$5496439d@news.astraweb.com> <85d1ogb6r5.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de 31TrCs2ANFsXcXGwrkZ0vwNwUin3e5LL0/O6PSowQcwA== Cancel-Lock: sha1:g89IrSySWQmavpxDTJeOS61ln4g= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'heavily': 0.04; '*not*': 0.07; 'javascript,': 0.07; 'any.': 0.09; 'foo,': 0.09; 'integers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'ruby,': 0.09; 'subject:while': 0.09; 'python': 0.10; 'python.': 0.11; 'foo\xe2\x80\x9d': 0.16; 'imo.': 0.16; 'intuition': 0.16; 'programmers.': 0.16; 'rather,': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'skip:j 30': 0.16; 'subject:make': 0.16; 'weigh': 0.16; 'language': 0.19; 'essential': 0.20; 'features,': 0.22; 'programming': 0.22; 'examples': 0.24; 'feature': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'header:X -Complaints-To:1': 0.26; 'least': 0.27; 'idea': 0.28; 'behaviour': 0.29; 'feature,': 0.29; 'somebody': 0.30; "d'aprano": 0.33; "he's": 0.33; 'steven': 0.33; 'surely': 0.33; "i'll": 0.33; 'gives': 0.35; 'so,': 0.35; 'programming.': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'say': 0.37; 'received:org': 0.37; 'things': 0.38; 'or,': 0.38; 'to:addr:python.org': 0.40; 'some': 0.40; 'avoid': 0.61; 'matter': 0.63; 'subject: / ': 0.63; 'importantly,': 0.66; 'talking': 0.67; 'subject': 0.70; 'design.': 0.72; '*learn': 0.84; '_o__)': 0.84; 'appeals': 0.84; 'confusing': 0.84; 'irrelevant': 0.84; 'justified.': 0.84; 'received:125': 0.84; 'subject:else': 0.84; 'subject:sense': 0.84; 'ice': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) 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: <85d1ogb6r5.fsf@benfinney.id.au> X-Mailman-Original-References: <573EC62F.4090401@lucidity.plus.com> <573f9322$0$1616$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:108877 Steven D'Aprano writes: > Just about the only things in Python which are intuitive and not > confusing to somebody are None and ints. I'll go even further: * The behaviour of ‘int’ is confusing to some. For example, to those who expect integers to produce fractions when divided. * The behaviour of ‘None’ is confusing to some. For example, to those who expect it to be a non-value, with no type. Examples of both those have appeared in this very forum in recent years. So, I think we can assert with confidence: if “avoid bevause it is unintuitive and confusing to some newcomers” were a good reason to avoid a Python feature, *all* Python features would be subject to oblivion. > Or, we can *learn how to use the features* and stop thinking that > programming is a matter of intuition. And most importantly, stop > thinking that features need to be judged entirely by the least > knowledgeable programmers. Yes. Appeals to intuition are irrelevant in talking about language features, IMO. The intuitions of newcomers should weigh heavily in language design. That is *not* the same as appealing to intuition: intuition gives you none of the essential and difficult concepts necessary to programming. > 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. This is not to say that every Python feature can be used without concern. Steven is not arguing that avoidance of a feature is never justified. Rather, he's demonstrating that *that particular justification* is void. There may be a good reason to avoid Python behaviour Foo, but “because JavaScript/Ruby/Lisp/BASIC/INTERCAL doesn't have behaviour Foo” is not a valid justification. The case must be argued on other merits, if any. -- \ “Special today: no ice cream.” —mountain inn, Switzerland | `\ | _o__) | Ben Finney