[Python-Dev] extended slicing again
17 Jun 2002 15:26:22 +0100
Guido van Rossum <email@example.com> writes:
> > The trouble is, there's no way to distinguish between
> > l1[a:b:]
> > l1[slice(a,b)]
> > I deliberately made the former be the same as l1[a:b:1] (and so have the
> > restriction on the length of slice) to reduce special-casing (both for
> > the user and me). Do you think I got that wrong?
> Yes I think you got that wrong. __getslice__ and __setlice__ are
> being deprecated (or at least discouraged), so you'll have objects
> implementing only __getitem__. Such objects will get a slice object
> passed to __getitem__ even for simple (one-colon) slices. If such an
> object wants to pass the slice on to a list object underlying the
> implementation, it should be allowed to.
> IOW slice(a, b, None) should be considered equivalent to L[a:b] in all
OK. I'll do this soon. It's not as bad as I thought at first -- only
mutable sequences are affected, so it's only lists and arrays that
need to be tweaked.
Our lecture theatre has just crashed. It will currently only
silently display an unexplained line-drawing of a large dog
accompanied by spookily flickering lights.
-- Dan Sheppard, ucam.chat (from Owen Dunn's summary of the year)