[Python-3000] range() issues

Alexander Belopolsky alexander.belopolsky at gmail.com
Sun Apr 27 13:07:31 CEST 2008


On Sat, Apr 26, 2008 at 2:49 PM, Facundo Batista
<facundobatista at gmail.com> wrote:

>  Which should the range() definition be, in your words?

In terms of ABCs,  range(..) is a Sized Iterable in the current
implementation.  It is not a Sequence because it is not a Container
and does not support slicing.  The idea to support x in range(..) was
discussed last year [1]  and appears to have been accepted but not
implemented. I understand that slicing support is in the works. [2]

I believe it would make sense to turn range(..) into a Sequence.  Here
are my reasons:

1. It will be easy to explain what range(..) is: "a sequence of
integers from start to stop, excluding stop, skipping step".

2. There will be fewer 2 to 3 incompatibilities.

[1] http://mail.python.org/pipermail/python-3000/2007-July/009028.html
[2] http://bugs.python.org/msg65807


More information about the Python-3000 mailing list