Path: csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'that?': 0.05; 'default.': 0.07; 'bounds.': 0.09; 'indexes': 0.09; 'iterate': 0.09; 'loop.': 0.09; 'bound,': 0.16; 'declaration': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'imo.': 0.16; 'iterating': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'reason.': 0.16; 'received:192.168.1.4': 0.16; 'verbose': 0.16; 'worst': 0.16; 'wrote:': 0.16; 'programmer': 0.18; 'language': 0.19; '>>>': 0.20; '2015': 0.20; 'pascal': 0.22; 'sep': 0.22; 'programming': 0.22; 'am,': 0.23; 'thus': 0.24; 'header:In-Reply-To:1': 0.24; 'header :User-Agent:1': 0.26; 'example': 0.26; 'rest': 0.26; 'specify': 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; '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; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'some': 0.40; 'default': 0.61; 'different': 0.63; 'believe': 0.66; 'upper': 0.76; '99.9%': 0.84 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=CvRCCSMD c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=EBOSESyhAAAA:8 a=IkcTkHD0fZMA:10 a=pGLkceISAAAA:8 a=SGBCz-xq5GjQ-d87lO4A:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett@:2500 Subject: Re: Python handles globals badly. To: python-list@python.org References: <86fa425b-d660-45ba-b0f7-3beebdec8e14@googlegroups.com> <55EE9EEC.1060907@rece.vub.ac.be> From: MRAB Date: Tue, 8 Sep 2015 18:41:45 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1441734109 news.xs4all.nl 23776 [2001:888:2000:d::a6]:56109 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96138 On 2015-09-08 15:31, Ian Kelly wrote: > 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. > In Pascal you specify both the lower and the upper bounds. > 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. >