Path: csiph.com!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!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; 'subject:Python': 0.05; 'that?': 0.05; 'default.': 0.07; 'indexes': 0.09; 'iterate': 0.09; 'loop.': 0.09; 'bound,': 0.16; 'declaration': 0.16; 'imo.': 0.16; 'iterating': 0.16; 'reason.': 0.16; 'verbose': 0.16; 'worst': 0.16; 'wrote:': 0.16; 'programmer': 0.18; 'language': 0.19; '>>>': 0.20; '2015': 0.20; 'sep': 0.22; 'programming': 0.22; 'am,': 0.23; 'thus': 0.24; 'header:In-Reply-To:1': 0.24; 'example': 0.26; 'rest': 0.26; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; 'array': 0.29; 'e.g.': 0.30; "i'd": 0.31; 'fixed': 0.31; 'option': 0.31; "can't": 0.32; 'languages': 0.34; 'tue,': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'there': 0.36; 'basic': 0.36; 'visual': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'means': 0.39; 'goes': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'some': 0.40; 'default': 0.61; 'different': 0.63; 'believe': 0.66; '99.9%': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=89hrf4wSPgz5cIF96iOgjS/BPmDfYW3EhL/XzPSGnVU=; b=Tmk5Cp4dMth9/2NjdEUWBNj4ClSHCP+/wx7JM8IXdxDDJ4vCpNFOJOnzhUlAbqig5p z6PHJnFsFZCv35W+LIJIy3KGEmpotcs1g+ubreSKCwHuqxFY9voU7oczN9x4lmdM4Quh 8waY8QfTEN6DtUGfJzvaVQ5m8qCvQvHvJ8UvTXXi1cJ7NaHXEt52d53xgXqFMqUBhOLI gpK0WX9rRGUrnU7IT5mQVEVSvs+AQiZJ/pCodyvQGk483nhH4GUcgAIt0H7HpgX5sa7t Ah7qSNz//JbC0uWco/qlnSCd7T+CSkbckS3Dy5YC+D+rzJku9WypM2A3OWuPWRfK9y9Z 4Ouw== X-Received: by 10.170.194.22 with SMTP id l22mr27511456yke.63.1441722704036; Tue, 08 Sep 2015 07:31:44 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <86fa425b-d660-45ba-b0f7-3beebdec8e14@googlegroups.com> <55EE9EEC.1060907@rece.vub.ac.be> From: Ian Kelly Date: Tue, 8 Sep 2015 08:31:04 -0600 Subject: Re: Python handles globals badly. To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1441722712 news.xs4all.nl 23837 [2001:888:2000:d::a6]:38570 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96131 On Tue, Sep 8, 2015 at 5:55 AM, Vladimir Ignatov wrote: >>> I had some experience programming in Lua and I'd say - that language >>> is bad example to follow. >>> Indexes start with 1 (I am not kidding) >> >> What is so bad about that? > > It's different from the rest 99.9% of languages for no particular reason. It's not "different from the rest 99.9% of languages". There are many languages that use 1-based indexing, e.g. Matlab, Pascal, Fortran. None of those are even the worst offender here, IMO. That honor goes to Visual Basic 6, where the default lower bound is 0, but the programmer has the option of declaring an array to use any lower bound they want, or even globally change the default. As a result you have to look up the array declaration to know the lower bound, and even then you can't be sure if it's not explicit. The correct way to iterate over a loop in VB 6 is thus not "FOR i = 0 TO n-1", but "FOR i = LBound(arr) TO UBound(arr)" which is overly verbose and means that you can't even be sure what indexes you're actually iterating over inside the loop. I believe this wart is fixed in VB .NET.