Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #10576
| Subject | Re: What is xrange? |
|---|---|
| From | Brian Blais <bblais@bryant.edu> |
| Date | 2011-07-30 06:23 -0400 |
| References | <j0v23e$g6o$1@speranza.aioe.org> <4e335ce4$0$29977$c3e8da3$5496439d@news.astraweb.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1654.1312025049.1164.python-list@python.org> (permalink) |
On Jul 29, 2011, at 9:22 PM, Steven D'Aprano wrote: > Billy Mays wrote: > >> Is xrange not a generator? I know it doesn't return a tuple or list, so >> what exactly is it? > > 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. > 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 -- Brian Blais bblais@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What is xrange? Billy Mays <noway@nohow.com> - 2011-07-29 15:36 -0400
Re: What is xrange? harrismh777 <harmar@member.fsf.org> - 2011-07-29 14:47 -0500
Re: What is xrange? Thomas Jollans <t@jollybox.de> - 2011-07-29 22:31 +0200
Re: What is xrange? Jerry Hill <malaclypse2@gmail.com> - 2011-07-29 16:36 -0400
Re: What is xrange? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-30 11:22 +1000
Re: What is xrange? Brian Blais <bblais@bryant.edu> - 2011-07-30 06:23 -0400
Re: What is xrange? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-30 21:36 +1000
Re: What is xrange? Brian Blais <bblais@bryant.edu> - 2011-07-30 09:46 -0400
Re: What is xrange? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-07-30 17:06 -0700
Re: What is xrange? Chris Angelico <rosuav@gmail.com> - 2011-07-31 01:10 +0100
Re: What is xrange? Ethan Furman <ethan@stoneleaf.us> - 2011-07-30 23:42 -0700
Re: What is xrange? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-31 12:18 +1200
csiph-web