Re: Python 3: range objects cannot be sliced

2009-01-25 Thread John Machin
On Jan 26, 12:08 pm, Terry Reedy wrote: > Fuzzyman wrote: > > On Jan 25, 2:28 pm, Alan G Isaac 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 oppos

Re: Python 3: range objects cannot be sliced

2009-01-25 Thread Terry Reedy
Fuzzyman wrote: On Jan 25, 2:28 pm, Alan G Isaac 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. Quotin

Re: Python 3: range objects cannot be sliced

2009-01-25 Thread Fuzzyman
On Jan 25, 2:28 pm, Alan G Isaac 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: > >  

Re: Python 3: range objects cannot be sliced

2009-01-25 Thread Alan G Isaac
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-bytes-bytearray-list-tuple-range But then again, the opposite is also documented, since `range` is a sequence type. Quoting: Sequences also support

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
It is documented: http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Christian Heimes
Alan G Isaac schrieb: > On 1/16/2009 1:15 PM Paul Rubin apparently wrote: >> range is an iterator now. Try itertools.islice. > > Well yes, it behaves like xrange did. > But (also like xrange) it supports indexing. (!) > So why not slicing? > I expected this (to keep it functionally > more similar

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
On 1/16/2009 1:15 PM Paul Rubin apparently wrote: range is an iterator now. Try itertools.islice. Well yes, it behaves like xrange did. But (also like xrange) it supports indexing. (!) So why not slicing? I expected this (to keep it functionally more similar to the old range). Alan Isaac -- h

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Paul Rubin
Alan G Isaac writes: > >>> x = range(20) > >>> s = slice(None,None,2) > >>> x[s] > Traceback (most recent call last): >File "", line 1, in > TypeError: sequence index must be integer, not 'slice' range is an iterator now. Try itertools.islice. -- http://mail.python.org/mailman/listinfo/p

Re: Python 3: range objects cannot be sliced

2009-01-16 Thread Fuzzyman
On Jan 16, 5:45 pm, Alan G Isaac wrote: > Is the behavior below expected? Documented? > (The error msg is misleading.) > Thanks, > Alan Isaac > >  >>> x = range(20) >  >>> s = slice(None,None,2) >  >>> x[s] > Traceback (most recent call last): >    File "", line 1, in > TypeError: sequence index

Python 3: range objects cannot be sliced

2009-01-16 Thread Alan G Isaac
Is the behavior below expected? Documented? (The error msg is misleading.) Thanks, Alan Isaac >>> x = range(20) >>> s = slice(None,None,2) >>> x[s] Traceback (most recent call last): File "", line 1, in TypeError: sequence index must be integer, not 'slice' -- http://mail.python.org/mailman/li