[Python-Dev] behavior of inplace operations

Guido van Rossum guido@python.org
Mon, 17 Jun 2002 08:59:46 -0400


> 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.
> 
>    >>> a[2:9] = a[2:9] + [666]
>    >>> a
>    [0, 1, 2, 3, 4, 5, 6, 7, 8, 666, 9, 10, 11]
> 
> Jeremy

Yeah, I think this is a bug introduced when MWH added support for
extended slices.  I hope he'll fix it so I won't have to. :-)

--Guido van Rossum (home page: http://www.python.org/~guido/)