[Python-Dev] (no subject)

Michael Hudson mwh@python.net
Mon, 17 Jun 2002 14:03:24 +0100


My starship mail currently seems to be broken in and out, so this is my 
first mail sent with Mac OS X's Mail.app.  I hope it comes out plain 
text...

> Current CVS says:
>
>    >>> a = range(12)
>    >>> t0,t1 = a,slice(2, 9)
>    >>> t0[t1] = t0[t1] + [666]
>    Traceback (most recent call last):
>      File "<stdin>", line 1, in ?
>    ValueError: attempt to assign list of size 8 to extended slice of
>    size 7
>
> I suspect this is a bug, since I didn't ask for an extended slice.

Yes you did :)

If you'd have tried that with any released Python, you'd have got a 
TypeError.

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?

Cheers,
M.