[Python-Dev] xrange identity crisis

Martin v. Loewis martin@v.loewis.de
05 Jun 2002 00:07:36 +0200

Oren Tirosh <oren-py-d@hishome.net> writes:

>    ... why shouldn't an xrange have an xrangeiterator? 

Because that would create an additional object.

> It's the only way to make xrange behave consistently with other iterables.  

Why does it have to be consistent?

> I know it works just fine the way it is.  But I see a lot of confusion on 
> the python list around the semantics of iterators and this behavior might 
> make it just a little bit worse.

Why do you think people will get confused? Most people will use it in
the canoncical form

for i in range(maxvalue)

in which case they cannot experience any difference (except for the
performance boost)?