Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10579

Re: What is xrange?

Subject Re: What is xrange?
From Brian Blais <bblais@bryant.edu>
Date 2011-07-30 09:46 -0400
References <j0v23e$g6o$1@speranza.aioe.org> <4e335ce4$0$29977$c3e8da3$5496439d@news.astraweb.com> <mailman.1654.1312025049.1164.python-list@python.org> <4e33ecc4$0$29987$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.1656.1312033579.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Jul 30, 2011, at 7:36 AM, Steven D'Aprano wrote:

> xrange objects might be lazily generated, but
> they're also sequence types: you can get their length, and you can index
> them. (However you can't slice them.) Iterators are not sequence types:
> they aren't indexable and you can't get their length.

ah!  now that makes sense.  I guess I never check their length, or index them, and only use them like generators.  :)

thanks for the clarification!

> It isn't like the Python developers are sitting around bored, looking for
> things to do. They are overworked with far too much to do and not enough
> manpower or time to do it. There are a huge number of much more important
> bug fixes and features that haven't been dealt with for them to bother with
> something like this.

Now, that seems a little harsh, and nothing that I was intending.  I figured (before learning about getting its length and indexing) that if the xrange object was basically a pre-generator hack, that it would make sense from a code-clarity point of view to reimplement them as generators -- it would gave made the developer's life easier.  Now that I realize that xrange has different functionality than a generator (which was the point of my question...just curious *what* different functionality) it clearly doesn't make sense to implement them as generators.  I certainly wasn't trying to imply that the developers are lazy, or bored!


			bb
> 
> 
> 
> -- 
> Steven
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
Brian Blais
bblais@bryant.edu
http://web.bryant.edu/~bblais
http://bblais.blogspot.com/


Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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