Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!news2.euro.net!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:verizon.net': 0.07; 'generators': 0.09; 'header:In-reply-to:1': 0.09; 'received:206.46': 0.09; 'received:206.46.173': 0.09; 'tuple': 0.09; 'wrote:': 0.15; 'billy': 0.16; 'out?': 0.16; 'received:206.46.173.17': 0.16; 'received:vms173017pub.verizon.net': 0.16; 'x-mailer:apple mail (2.1084)': 0.16; 'xrange': 0.16; 'cc:addr:python-list': 0.16; 'pm,': 0.16; "wouldn't": 0.17; 'cc:2**0': 0.21; "doesn't": 0.22; 'url:edu': 0.28; "wasn't": 0.28; 'cc:addr:python.org': 0.30; 'protocol.': 0.30; 'subject:?': 0.31; 'values': 0.31; 'this.': 0.31; 'brian': 0.33; 'it?': 0.34; 'there': 0.34; 'subject:What': 0.35; 'charset:us-ascii': 0.36; 'using': 0.37; 'subject:: ': 0.38; 'steven': 0.38; 'list,': 0.39; 'special': 0.67; 'received:home': 0.91; 'forever.': 0.95 Subject: Re: What is xrange? MIME-version: 1.0 (Apple Message framework v1084) Content-type: text/plain; charset=us-ascii From: Brian Blais In-reply-to: <4e335ce4$0$29977$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 30 Jul 2011 06:23:45 -0400 Content-transfer-encoding: quoted-printable References: <4e335ce4$0$29977$c3e8da3$5496439d@news.astraweb.com> To: Steven D'Aprano X-Mailer: Apple Mail (2.1084) Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1312025049 news.xs4all.nl 23913 [2001:888:2000:d::a6]:35168 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10576 On Jul 29, 2011, at 9:22 PM, Steven D'Aprano wrote: > Billy Mays wrote: >=20 >> Is xrange not a generator? I know it doesn't return a tuple or list, = so >> what exactly is it? =20 >=20 > xrange pre-dates generators by approximately forever. It returns a > special "xrange object", which generates values suitable for use in > for-loops using the old __getitem__ protocol. >=20 interesting...I never really thought about this. Is there a reason that = it wasn't reimplemented when generators came out? Is there a use-case = for the current implementation that wouldn't work as a generator? bb --=20 Brian Blais bblais@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/