PEP 260: simplify xrange()

Dinu Gherman gherman at
Wed Jun 27 09:31:11 CEST 2001

Guido van Rossum wrote:
> Proposed Solution
> [...]
>     By implementing a custom iterator type, we could speed up the
>     common use, but this is optional (the default sequence iterator
>     does just fine).

This reduces xrange effectively to a more efficient iterator,
and I wonder if keeping 'xrange' as its name is any good,
apart for historical reasons? Sounds like people will ask:
but why is it called 'x*range*', if I cannot even say this:

  for i in xrange(10) + xrange(20): print i

Well, ok, you can't even now... (in range you can, though).

Maybe keeping xrange as a built-in *name* for an iterator 
might seem ok, before getting rid off it entirely?


PS: BTW, why not *add* something useful and make float 
    increments work "as expected" in range/xrange...?

More information about the Python-list mailing list