[Python-Dev] Re: More int/long integration issues

Guido van Rossum guido@python.org
Fri, 21 Mar 2003 09:55:16 -0500


> > Hm, maybe range() shouldn't be an iterator but an interator
> > generator.  No time to explain; see the discussion about restartable
> > iterators.
> 
> I think what you mean is fairly obvious.  list et al. are iterator
> generators, right?  It's just a thing with an __iter__ function which
> produces an iterator?
> 
> If so, I tend to agree that's the right behavior for range().
> range(x,y,z) should be an immutable object.

Yes.  Idioms like this are used fairly often:

  seq = range(...)

  for i in seq: ...
  for i in seq: ...
  # etc.

--Guido van Rossum (home page: http://www.python.org/~guido/)