Dave Opstad wrote: > In article <[EMAIL PROTECTED]>, > "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > >>So - the rationale seems to be: "When using slice-assignment, a form >>like l[a:b:c] imposes possibly a non-continous section in l, for which >>the semantics are unclear - so we forbid it" > > > But it isn't forbidden: > > >>>>v = range(10) >>>>v > > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] > >>>>v[0:10:3] = ['a', 'b', 'c', 'd'] >>>>v > > ['a', 1, 2, 'b', 4, 5, 'c', 7, 8, 'd'] > > The only time it's actively forbidden is when the length of the slice > and the length of the list being assigned to it don't match.
Oh, cool. But then the semantics are clear: if using [a:b:c] syntax, the replaced slice has to be of same lenght. Makes sense - and in that case, I'd prefer c==1 not to be special cased - for the sake of a more clearly defined behaviour. Regards, Diez -- http://mail.python.org/mailman/listinfo/python-list