Python 3: range objects cannot be sliced

Terry Reedy tjreedy at udel.edu
Mon Jan 26 02:08:15 CET 2009


Fuzzyman wrote:
> On Jan 25, 2:28 pm, Alan G Isaac <alan.is... at gmail.com> wrote:
>> On 1/16/2009 3:13 PM Alan G Isaac apparently wrote:
>>  > It is documented:
>>  >http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-b...
>>
>> But then again, the opposite is also documented,
>> since `range` is a sequence type.  Quoting:
>>
>>      Sequences also support slicing ...
>>
>>      Some sequences also support “extended slicing”
>>
>> Is this a documentation bug, or a bug in `range`?
>> (I'd think the latter.)

No range slicing is intended.

> Where does the documentation say that range objects are sequences?
> They're iterables.

Range objects (2.x xrange objects) were more sequence-like in 2.x. 3.0 
doc still says "There are five sequence types: strings, byte sequences, 
byte arrays, lists, tuples, and range objects" (the miscount has already 
been reported.)

I added a note to
    http://bugs.python.org/issue4966
suggesting that ranges be removed from the sequence section.
I made several other suggestions for improving this sections.

Supportive comments might help get action.

tjr




More information about the Python-list mailing list