[Python-3000] range() issues

Alexander Belopolsky alexander.belopolsky at gmail.com
Wed Apr 30 16:20:01 CEST 2008


On Wed, Apr 30, 2008 at 10:05 AM, Guido van Rossum <guido at python.org> wrote:
..
>  >
>  >  What would you say to an idea of exposing rangeiter in itertools - say
>  >  itertools.irange(..) function that returns an iterator?
>
>  You're kidding right? If you *want* the iterator, what's wrong with
>  iter(range(N))? It's even less characters than itertools.irange(N).
>  :-)

No, I was not kidding (but I may be acting as a performance freak:-).

Since you cannot reuse the result of iter(range(N)), using explicit
iter call over implicit does not save much.  I would be happy with
itertool.count(..) getting an optional stop argument instead of adding
irange().


More information about the Python-3000 mailing list