Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!lightspeed.eweka.nl!lightspeed.eweka.nl!newsfeed.xs4all.nl!newsfeed4.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.039 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'great.': 0.07; 'method,': 0.09; 'sure,': 0.09; 'iterator': 0.16; 'loops': 0.16; 'reedy': 0.16; 'xrange': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'pointed': 0.19; 'header:In-Reply-To:1': 0.27; 'originally': 0.30; 'then.': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'implemented': 0.33; 'except': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; "didn't": 0.36; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'realize': 0.39; 'to:addr:python.org': 0.39; 'ian': 0.60; 'introduced': 0.61; 'back': 0.62; '2015': 0.84; 'old.': 0.93 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=MZSJIsYc4oBZPiL973035X708RFgqem4LXTuBs0sZjI=; b=YSeWUtLGmgZe6Sr22ZyWAI8sBtfT+2zYooxRj5tXrQLtKCrsLeRiM8/UNsrpX3jQev VZsfZ9NyIVjZzIw6kqaUho0NvmAnIT9LGTxy52ApKw+jpvA1UMO8MDilg5L7wEVrkdZ/ yajPiarGYPDBDTCc4QPAbXvGKn1BytGQt1+L0MAlIVLhbrUGXY2k5Tm6+dFNEtluRoSq VIKlImXuGeyw/BNkU4WPYCTrH+IlfbRalrUoRuScAVsMmTEZg3CIzTGxNC42wy43MmRN zfjD2Rvc8khDd824j1nmx3gMaVtQMkVoFA5Hz7ecJgWP54GFg6elaslHNlgxbtqQJiqV iz+A== X-Received: by 10.107.12.158 with SMTP id 30mr6891640iom.61.1430628723216; Sat, 02 May 2015 21:52:03 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <87k2wtvbx1.fsf@Equus.decebal.nl> <_M61x.477467$Ek.357048@fx07.am4> From: Ian Kelly Date: Sat, 2 May 2015 22:51:22 -0600 Subject: Re: l = range(int(1E9)) 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: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1430628725 news.xs4all.nl 2946 [2001:888:2000:d::a6]:45226 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3958 X-Received-Body-CRC: 3632665959 Xref: csiph.com comp.lang.python:89829 On Sat, May 2, 2015 at 5:51 PM, Terry Reedy wrote: > On 5/2/2015 5:31 PM, Ian Kelly wrote: > >> Would it have been better if range() had been implemented as xrange() >> from the beginning? Sure, that would have been great. Except for one >> small detail: the iterator protocol didn't exist back then. > > > For loops originally used the getitem iterator protocol. xrange objects have > a __getitem__ method, but not __iter__ or __next__. As Mark pointed out, > they were introduced in 1993. I'm aware of getitem iterators; just didn't realize that xrange used it or was that old.