[Python-Dev] xrange identity crisis

Guido van Rossum guido@python.org
Tue, 04 Jun 2002 21:22:30 -0400

> The main defense is that the typical use case is 
> for i in xrange(len(some_list))
> In that case, it is desirable not to create an additional object, and
> nobody will notice the difference.

Is it really so bad if this allocates *two* objects instead of one?

I think that's the only to get my example to work correctly.  And it
*has* to work correctly.

If two objects are created anyway, I agree with Oren that it's better
to have a separate range-iterator object type.

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