slices: foo[i:j:k] => TypeError
Roman Neuhauser
neuhauser at mail.cz
Sat Apr 27 12:31:09 EDT 2002
> From: Alex Martelli <aleax at aleax.it>
> Subject: Re: slices: foo[i:j:k] => TypeError
> To: python-list at python.org
> Date: Fri, 26 Apr 2002 22:34:46 GMT
>
> Roman Neuhauser wrote:
> ...
> >>>> foo[0:6:2]
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in ?
> > TypeError: sequence index must be integer
> >>>>
> >
> > What's up? Is that a bug, or am I dumb?
>
> http://www.python.org/dev/doc/devel/lib/typesseq.html only
> mentions x:y slices; the x:y:z form is supported only by
> Numeric, I believe. The underlying problem is that list &c
> still use the deprecated __getslice__ (or equivalent thereof)
> rather than accepting slice objects in __getitem__ (&c for
> set and del).
Ok. What I don't understand then is why is extended slicing
described among primaries in the language reference. And I'm not
talking about a development version of the manual, I'm talking about
the 2.1 version.
What's the expected date for the builtin types to accept slice
objects?
--
FreeBSD 4.4-STABLE
6:26PM up 12 days, 7:38, 10 users, load averages: 0.04, 0.04, 0.01
More information about the Python-list
mailing list